Database governance built for humans and agents — controlling changes and access across every major database.
Go cicddata-governancedata-maskingdata-securitydatabase-accessdatabase-governancedevopsdevsecopsflywaygitopsliquibasemongodbmysqloraclepostgresqlschema-migrationssecuritysql-clientsqlservertidb
refactor(frontend): switch, dropdown and visible options (#21489)
ecmadao3fcc8ad7ee2b
diff --git a/docs/agents/frontend-ux.md b/docs/agents/frontend-ux.mdindex 8710ac199e..05fc993575 100644--- a/docs/agents/frontend-ux.md+++ b/docs/agents/frontend-ux.md@@ -196,15 +196,34 @@ behavior:### Choice Controls-- Use the shared `Switch` only for an independent binary behavior: its label- names the behavior being enabled, such as "Use SSH tunnel" or "Sync all- databases". The off state MUST have a clear, meaningful result.-- Use `RadioGroup` for two peer values where neither value is an enabled or- disabled version of the other, such as `TCP` versus `UDP`. Keep both values- visible when users need to compare them or their descriptions.-- Use the shared `Select` dropdown for more than two mutually exclusive- options. It MAY also be used for two peer values when space is constrained- and comparison is unnecessary.+- Choose the control from the decision, not merely the number of options.+ First ask whether users need to see the alternatives together to understand+ or compare the choice. If they do, use a visible `RadioGroup`; if they do+ not, use `Select` to keep the form compact. A small option count alone does+ not make either control correct.+- Use the shared `Switch` for one stateful binary setting, regardless of+ whether the surrounding form saves it immediately or later. Its label names+ the enabled behavior or state, such as "Use SSH tunnel", "Production+ environment", or "Sync all databases". The off state MUST have a clear,+ meaningful result.+- Use `Checkbox` for selection or acknowledgement: selecting one or more+ items, including an optional item in a submission, accepting terms, or+ confirming a destructive action. A grouped set of independent requirements,+ such as password-character requirements, MAY also use checkboxes. Do not use+ a single checkbox for a standalone enabled or disabled setting.+- Use `RadioGroup` for a small set of peer values where users need to compare+ the alternatives, their descriptions, consequences, or availability. Use+ choice-card styling when that supporting context matters, such as onboarding+ goals, cancellation reasons, access scope, and security modes.+- Do not replace a consequential first-step choice with a dropdown solely+ because it has a small number of options. For example, identity-provider+ types need visible descriptions and feature availability so users can choose+ the integration model before they enter a configuration flow.+- Use the shared `Select` dropdown for many, familiar, or low-context mutually+ exclusive options where compactness is more useful than comparison, such as+ themes, export formats, environments, and webhook destinations. It MAY also+ be used for two peer values when space is constrained and comparison is+ unnecessary.- Do not use `SegmentedControl` for ordinary form values. Reserve it forcompact view or mode controls outside forms.diff --git a/frontend/src/components/DataExportButton.tsx b/frontend/src/components/DataExportButton.tsxindex 8ce516f3b1..453e3a5063 100644--- a/frontend/src/components/DataExportButton.tsx+++ b/frontend/src/components/DataExportButton.tsx@@ -20,7 +20,13 @@ import {DropdownMenuTrigger,} from "@/components/ui/dropdown-menu";import { Input } from "@/components/ui/input";-import { RadioGroup, RadioGroupItem } from "@/components/ui/radio-group";+import {+ Select,+ SelectContent,+ SelectItem,+ SelectTrigger,+ SelectValue,+} from "@/components/ui/select";import {Sheet,SheetBody,@@ -415,16 +421,23 @@ export function DataExportButton({<label className="text-sm text-control">{t("export-data.export-format")}</label>- <RadioGroup+ <Selectvalue={String(format)}- onValueChange={(v) => setFormat(Number(v) as ExportFormat)}+ onValueChange={(value) => {+ if (value) setFormat(Number(value) as ExportFormat);+ }}>- {supportFormats.map((fmt) => (- <RadioGroupItem key={fmt} value={String(fmt)}>- {ExportFormat[fmt]}- </RadioGroupItem>- ))}- </RadioGroup>+ <SelectTrigger className="w-full">+ <SelectValue>{ExportFormat[format]}</SelectValue>+ </SelectTrigger>+ <SelectContent>+ {supportFormats.map((fmt) => (+ <SelectItem key={fmt} value={String(fmt)}>+ {ExportFormat[fmt]}+ </SelectItem>+ ))}+ </SelectContent>+ </Select></div>{supportPassword && (diff --git a/frontend/src/components/EditEnvironmentSheet.tsx b/frontend/src/components/EditEnvironmentSheet.tsxindex 89f5029885..af018f7110 100644--- a/frontend/src/components/EditEnvironmentSheet.tsx+++ b/frontend/src/components/EditEnvironmentSheet.tsx@@ -2,7 +2,13 @@ import { useEffect, useState } from "react";import { useTranslation } from "react-i18next";import { EnvironmentLabel } from "@/components/EnvironmentLabel";import { Button } from "@/components/ui/button";-import { RadioGroup, RadioGroupItem } from "@/components/ui/radio-group";+import {+ Select,+ SelectContent,+ SelectItem,+ SelectTrigger,+ SelectValue,+} from "@/components/ui/select";import {Sheet,SheetBody,@@ -12,7 +18,6 @@ import {SheetTitle,} from "@/components/ui/sheet";import { useEnvironmentList } from "@/hooks/useAppState";-import { cn } from "@/lib/utils";export function EditEnvironmentSheet({open,@@ -35,6 +40,10 @@ export function EditEnvironmentSheet({}}, [open]);+ const selectedEnvironment = environments.find(+ (environment) => environment.name === selected+ );+return (<Sheet open={open} onOpenChange={(next) => !next && onClose()}><SheetContent width="narrow">@@ -42,26 +51,25 @@ export function EditEnvironmentSheet({<SheetTitle>{t("database.edit-environment")}</SheetTitle></SheetHeader><SheetBody>- <RadioGroup- className="flex-col items-stretch gap-y-1"+ <Selectvalue={selected}- onValueChange={(value) => setSelected(value as string)}+ onValueChange={(value) => setSelected(String(value))}>- {environments.map((env) => (- <RadioGroupItem- key={env.name}- value={env.name}- className={cn(- "flex items-center gap-x-3 px-3 py-2.5 rounded-sm cursor-pointer border transition-colors",- selected === env.name- ? "border-accent bg-accent/5"- : "border-transparent hover:bg-control-bg"+ <SelectTrigger className="w-full">+ <SelectValue placeholder={t("common.select")}>+ {selectedEnvironment && (+ <EnvironmentLabel environment={selectedEnvironment} />)}- >- <EnvironmentLabel environment={env} />- </RadioGroupItem>- ))}- </RadioGroup>+ </SelectValue>+ </SelectTrigger>+ <SelectContent>+ {environments.map((env) => (+ <SelectItem key={env.name} value={env.name}>+ <EnvironmentLabel environment={env} />+ </SelectItem>+ ))}+ </SelectContent>+ </Select></SheetBody><SheetFooter><Button appearance="secondary" onClick={onClose}>diff --git a/frontend/src/components/instance/OracleConnectionFields.tsx b/frontend/src/components/instance/OracleConnectionFields.tsxindex be41ed6f48..00c533ba09 100644--- a/frontend/src/components/instance/OracleConnectionFields.tsx+++ b/frontend/src/components/instance/OracleConnectionFields.tsx@@ -1,7 +1,7 @@import { useId, useState } from "react";import { useTranslation } from "react-i18next";import { FormLabel } from "@/components/ui/form";-import { SegmentedControl } from "@/components/ui/segmented-control";+import { RadioGroup, RadioGroupItem } from "@/components/ui/radio-group";import { ValidationField, ValidationInput } from "./ValidationField";type Identifier = { sid: string; serviceName: string };@@ -80,17 +80,19 @@ export function OracleConnectionFields({className="sm:col-span-3 sm:col-start-1"title={t("instance.connect-using")}>- <SegmentedControl- size="sm"- ariaLabel={t("instance.connect-using")}+ <RadioGroup+ className="gap-x-4"+ aria-label={t("instance.connect-using")}value={state.mode}- options={[- { value: "serviceName", label: t("instance.service-name") },- { value: "sid", label: t("instance.sid") },- ]}- disabled={!allowEdit}- onValueChange={(mode) => update(mode, state.drafts)}- />+ onValueChange={(mode) => update(mode as IdentifierMode, state.drafts)}+ >+ <RadioGroupItem value="serviceName" disabled={!allowEdit}>+ {t("instance.service-name")}+ </RadioGroupItem>+ <RadioGroupItem value="sid" disabled={!allowEdit}>+ {t("instance.sid")}+ </RadioGroupItem>+ </RadioGroup></ValidationField><ValidationFieldvalidationField="serviceName"diff --git a/frontend/src/components/sql-review/RuleComponents.tsx b/frontend/src/components/sql-review/RuleComponents.tsxindex d7f419dc28..6affa8542a 100644--- a/frontend/src/components/sql-review/RuleComponents.tsx+++ b/frontend/src/components/sql-review/RuleComponents.tsx@@ -19,6 +19,7 @@ import {SelectTrigger,SelectValue,} from "@/components/ui/select";+import { Switch } from "@/components/ui/switch";import { Tooltip } from "@/components/ui/tooltip";import i18n from "@/lib/i18n";import type { PayloadValueType } from "@/lib/sql-review/rule-config-types";@@ -248,7 +249,7 @@ export function RuleConfig({{config.payload.type === "BOOLEAN" && (<FormControlRow>- <Checkbox+ <Switchchecked={(payload[index] as boolean) ?? false}disabled={disabled}onCheckedChange={(checked) => updatePayload(index, checked)}diff --git a/frontend/src/locales/en-US.json b/frontend/src/locales/en-US.jsonindex 277000371d..d546f3285c 100644--- a/frontend/src/locales/en-US.json+++ b/frontend/src/locales/en-US.json@@ -3587,8 +3587,7 @@},"prior-backup": "Prior backup","run-immediately": {- "description": "Tasks will start executing as soon as you click Run. No delay or scheduling required.",- "self": "Run immediately"+ "description": "Tasks will start executing as soon as you click Run. No delay or scheduling required."},"run-task": "Run task | Run tasks","schedule-for-later": {diff --git a/frontend/src/locales/es-ES.json b/frontend/src/locales/es-ES.jsonindex 091eac1665..2e5907a5da 100644--- a/frontend/src/locales/es-ES.json+++ b/frontend/src/locales/es-ES.json@@ -3587,8 +3587,7 @@},"prior-backup": "Respaldo previo","run-immediately": {- "description": "Las tareas comenzarán a ejecutarse en cuanto haga clic en \"Ejecutar\". No requiere demora ni programación.",- "self": "Corre inmediatamente"+ "description": "Las tareas comenzarán a ejecutarse en cuanto haga clic en \"Ejecutar\". No requiere demora ni programación."},"run-task": "Ejecutar tarea | Ejecutar tareas","schedule-for-later": {diff --git a/frontend/src/locales/ja-JP.json b/frontend/src/locales/ja-JP.jsonindex 8a4b58e2f1..745d506b0a 100644--- a/frontend/src/locales/ja-JP.json+++ b/frontend/src/locales/ja-JP.json@@ -3587,8 +3587,7 @@},"prior-backup": "影響を受けるデータの事前バックアップ","run-immediately": {- "description": "「実行」をクリックするとすぐにタスクの実行が開始されます。遅延やスケジュール設定は必要ありません。",- "self": "すぐに実行"+ "description": "「実行」をクリックするとすぐにタスクの実行が開始されます。遅延やスケジュール設定は必要ありません。"},"run-task": "タスクを実行 | タスクを実行","schedule-for-later": {diff --git a/frontend/src/locales/vi-VN.json b/frontend/src/locales/vi-VN.jsonindex 57d5f22919..e14ed70950 100644--- a/frontend/src/locales/vi-VN.json+++ b/frontend/src/locales/vi-VN.json@@ -3587,8 +3587,7 @@},"prior-backup": "Sao lưu trước","run-immediately": {- "description": "Các tác vụ sẽ bắt đầu thực thi ngay khi bạn nhấp vào Chạy. Không cần trì hoãn hay lên lịch.",- "self": "Chạy ngay lập tức"+ "description": "Các tác vụ sẽ bắt đầu thực thi ngay khi bạn nhấp vào Chạy. Không cần trì hoãn hay lên lịch."},"run-task": "Chạy tác vụ | Chạy tác vụ","schedule-for-later": {diff --git a/frontend/src/locales/zh-CN.json b/frontend/src/locales/zh-CN.jsonindex 065e96b45e..0e2cf75871 100644--- a/frontend/src/locales/zh-CN.json+++ b/frontend/src/locales/zh-CN.json@@ -3587,8 +3587,7 @@},"prior-backup": "预备份受影响数据","run-immediately": {- "description": "点击“运行”后,任务将立即开始执行。",- "self": "立即运行"+ "description": "点击“运行”后,任务将立即开始执行。"},"run-task": "运行任务 | 运行任务","schedule-for-later": {diff --git a/frontend/src/routes/auth/WorkspaceSetupQuestionnaireStep.test.tsx b/frontend/src/routes/auth/WorkspaceSetupQuestionnaireStep.test.tsxindex c972de07e2..4389b3ae17 100644--- a/frontend/src/routes/auth/WorkspaceSetupQuestionnaireStep.test.tsx+++ b/frontend/src/routes/auth/WorkspaceSetupQuestionnaireStep.test.tsx@@ -128,6 +128,7 @@ describe("WorkspaceSetupQuestionnaireStep", () => {act(() =>fireEvent.click(labels.find((label) => label.textContent?.includes("My team"))!+ .querySelector('[role="radio"]')!));@@ -140,7 +141,13 @@ describe("WorkspaceSetupQuestionnaireStep", () => {const onContinue = vi.fn();const page = renderQuestionnaire({ onContinue });- act(() => fireEvent.click(page.container.querySelector("button")!));+ act(() =>+ fireEvent.click(+ [...page.container.querySelectorAll("button")].find((button) =>+ button.textContent?.includes("Continue")+ )!+ )+ );expect(onContinue).toHaveBeenCalledOnce();page.unmount();diff --git a/frontend/src/routes/project/ProjectMaskingExemptionCreatePage.test.tsx b/frontend/src/routes/project/ProjectMaskingExemptionCreatePage.test.tsxindex dcb336ecbf..4a2a2e6c28 100644--- a/frontend/src/routes/project/ProjectMaskingExemptionCreatePage.test.tsx+++ b/frontend/src/routes/project/ProjectMaskingExemptionCreatePage.test.tsx@@ -255,11 +255,16 @@ const submittedExpression = (): string | undefined => {return arg?.policy.policy.value.exemptions[0]?.condition?.expression;};-const clickRadio = async (container: HTMLElement, index: number) => {- const radios = Array.from(- container.querySelectorAll<HTMLElement>('[role="radio"]')+const selectResourceMode = async (+ container: HTMLElement,+ value: "ALL" | "EXPRESSION" | "SELECT"+) => {+ const index = { ALL: 0, EXPRESSION: 1, SELECT: 2 }[value];+ await click(+ Array.from(container.querySelectorAll<HTMLElement>('[role="radio"]'))[+ index+ ]!);- await click(radios[index]!);};const clickConfirm = async (container: HTMLElement) => {@@ -290,9 +295,13 @@ describe("ProjectMaskingExemptionCreatePage builder (BYT-9788)", () => {mocks.getExpressionsForDatabaseResource.mockReset();});- test("keeps badges inside modal-opening radio controls non-clickable", () => {+ test("keeps resource scope choices visible", () => {const { container, unmount } = render();+ const radios = container.querySelectorAll('[role="radio"]');+ expect(radios).toHaveLength(3);+ expect(radios[0]).toHaveAttribute("aria-checked", "true");+const badges = container.querySelectorAll('[data-testid="feature-badge"]');expect(badges).toHaveLength(2);for (const badge of badges) {@@ -306,7 +315,7 @@ describe("ProjectMaskingExemptionCreatePage builder (BYT-9788)", () => {const { container, unmount } = render();await flush();- await clickRadio(container, 2); // SELECT+ await selectResourceMode(container, "SELECT");await click(container.querySelector<HTMLElement>('[data-testid="set-two-resources"]')!);@@ -333,7 +342,7 @@ describe("ProjectMaskingExemptionCreatePage builder (BYT-9788)", () => {const { container, unmount } = render();await flush();- await clickRadio(container, 2); // SELECT+ await selectResourceMode(container, "SELECT");await click(container.querySelector<HTMLElement>('[data-testid="set-two-resources"]')!);@@ -360,7 +369,7 @@ describe("ProjectMaskingExemptionCreatePage builder (BYT-9788)", () => {const { container, unmount } = render();await flush();- await clickRadio(container, 1); // EXPRESSION+ await selectResourceMode(container, "EXPRESSION");await click(container.querySelector<HTMLElement>('[data-testid="set-expr"]')!);diff --git a/frontend/src/routes/project/ProjectWebhookForm.test.tsx b/frontend/src/routes/project/ProjectWebhookForm.test.tsxindex f80b689d71..f2ed056f74 100644--- a/frontend/src/routes/project/ProjectWebhookForm.test.tsx+++ b/frontend/src/routes/project/ProjectWebhookForm.test.tsx@@ -122,4 +122,16 @@ describe("ProjectWebhookForm", () => {expect(container.textContent).not.toContain("project.webhook.url-hidden");});++ test("places the destination control below its label", () => {+ const container = renderForm(true);++ expect(+ container.querySelector('label[for="webhook-destination"]')+ ).toHaveClass("block");+ expect(container.querySelector("#webhook-destination")).toHaveClass(+ "mt-1",+ "w-full"+ );+ });});diff --git a/frontend/src/routes/project/ProjectWebhookForm.tsx b/frontend/src/routes/project/ProjectWebhookForm.tsxindex 454761c282..1a48145917 100644--- a/frontend/src/routes/project/ProjectWebhookForm.tsx+++ b/frontend/src/routes/project/ProjectWebhookForm.tsx@@ -27,8 +27,15 @@ import {DropdownMenuTrigger,} from "@/components/ui/dropdown-menu";import { Input } from "@/components/ui/input";-import { RadioGroup, RadioGroupItem } from "@/components/ui/radio-group";+import {+ Select,+ SelectContent,+ SelectItem,+ SelectTrigger,+ SelectValue,+} from "@/components/ui/select";import { StickyActionFooter } from "@/components/ui/sticky-action-footer";+import { Switch } from "@/components/ui/switch";import { Tooltip } from "@/components/ui/tooltip";import { WebhookTypeIcon } from "@/components/WebhookTypeIcon";import { pushNotification } from "@/stores";@@ -368,40 +375,39 @@ export function ProjectWebhookForm({{/* Destination type selector (create only) */}{create && (<div>- <label className="font-medium text-main">+ <label+ className="block font-medium text-main"+ htmlFor="webhook-destination"+ >{t("project.webhook.destination")}{" "}<span className="text-error">*</span></label>- <RadioGroup- className="mt-1 grid grid-cols-1 gap-4 sm:grid-cols-7"+ <Selectvalue={String(state.type)}- onValueChange={(value) => updateField("type", Number(value))}+ onValueChange={(value) => {+ if (value) updateField("type", Number(value));+ }}>- {webhookTypeItemList.map((item) => (- <div- key={item.type}- className={`flex justify-center px-2 py-4 rounded-sm border cursor-pointer hover:bg-control-bg-hover ${- state.type === item.type- ? "border-accent"- : "border-control-border"- }`}- onClick={() => updateField("type", item.type)}- >- <div className="flex flex-col items-center">- <WebhookTypeIcon type={item.type} className="size-10" />- <p className="mt-1 text-center text-sm font-medium">+ <SelectTrigger id="webhook-destination" className="mt-1 w-full">+ <SelectValue>+ {+ webhookTypeItemList.find(+ (item) => item.type === state.type+ )?.name+ }+ </SelectValue>+ </SelectTrigger>+ <SelectContent>+ {webhookTypeItemList.map((item) => (+ <SelectItem key={item.type} value={String(item.type)}>+ <span className="flex items-center gap-x-2">+ <WebhookTypeIcon type={item.type} className="size-4" />{item.name}- </p>- <div className="mt-3">- <RadioGroupItem- value={String(item.type)}- aria-label={item.name}- />- </div>- </div>- </div>- ))}- </RadioGroup>+ </span>+ </SelectItem>+ ))}+ </SelectContent>+ </Select></div>)}@@ -528,7 +534,7 @@ export function ProjectWebhookForm({</span><div className="flex items-center mt-2"><label className="flex items-center gap-x-2 cursor-pointer">- <Checkbox+ <Switchchecked={state.directMessage}disabled={!activitySupportDirectMessage}onCheckedChange={(checked) =>diff --git a/frontend/src/routes/project/database-detail/catalog/GrantAccessDialog.test.tsx b/frontend/src/routes/project/database-detail/catalog/GrantAccessDialog.test.tsxindex 3edab938e7..12baa25212 100644--- a/frontend/src/routes/project/database-detail/catalog/GrantAccessDialog.test.tsx+++ b/frontend/src/routes/project/database-detail/catalog/GrantAccessDialog.test.tsx@@ -281,14 +281,31 @@ const flush = async () => {});};-const getRadios = (container: HTMLElement) =>- Array.from(container.querySelectorAll<HTMLElement>('[role="radio"]'));+const resourceModeValues = ["ALL", "EXPRESSION", "SELECT"] as const;-const isChecked = (radio: HTMLElement | undefined) =>- radio?.getAttribute("aria-checked") === "true";+const getResourceModeRadios = (container: HTMLElement) =>+ Array.from(container.querySelectorAll<HTMLElement>('[role="radio"]'));-const isDisabled = (radio: HTMLElement | undefined) =>- radio?.getAttribute("aria-disabled") === "true";+const selectedResourceMode = (container: HTMLElement) =>+ resourceModeValues.find(+ (_, index) =>+ getResourceModeRadios(container)[index]?.getAttribute("aria-checked") ===+ "true"+ );++const isResourceModeDisabled = (+ container: HTMLElement,+ value: (typeof resourceModeValues)[number]+) => getResourceModeRadios(container)[resourceModeValues.indexOf(value)]?.getAttribute("aria-disabled") === "true";++const selectResourceMode = async (+ container: HTMLElement,+ value: "ALL" | "EXPRESSION" | "SELECT"+) => {+ await click(+ getResourceModeRadios(container)[resourceModeValues.indexOf(value)]!+ );+};const deferred = <T,>() => {let resolve!: (value: T) => void;@@ -379,10 +396,14 @@ describe("GrantAccessDialog", () => {mocks.stringifyConditionExpression.mockClear();});- test("keeps badges inside modal-opening radio controls non-clickable", async () => {+ test("keeps resource scope choices visible", async () => {const { container, unmount } = renderGrantAccessDialog();await flush();+ expect(getResourceModeRadios(container)).toHaveLength(3);+ expect(selectedResourceMode(container)).toBe("SELECT");+ expect(isResourceModeDisabled(container, "ALL")).toBe(true);+const badges = container.querySelectorAll('[data-testid="feature-badge"]');expect(badges).toHaveLength(2);for (const badge of badges) {@@ -396,12 +417,9 @@ describe("GrantAccessDialog", () => {const { container, unmount } = renderGrantAccessDialog();await flush();- const radioList = getRadios(container);+ expect(selectedResourceMode(container)).toBe("SELECT");- expect(radioList).toHaveLength(3);- expect(isChecked(radioList[2])).toBe(true);-- await click(radioList[1]!);+ await selectResourceMode(container, "EXPRESSION");expect(mocks.stringifyConditionExpression).toHaveBeenCalledWith({databaseResources: [@@ -429,20 +447,18 @@ describe("GrantAccessDialog", () => {const { container, unmount } = renderGrantAccessDialog();await flush();- let radioList = getRadios(container);- expect(isDisabled(radioList[0])).toBe(true);- expect(isDisabled(radioList[1])).toBe(false);- expect(isDisabled(radioList[2])).toBe(false);+ expect(isResourceModeDisabled(container, "ALL")).toBe(true);+ expect(isResourceModeDisabled(container, "EXPRESSION")).toBe(false);+ expect(isResourceModeDisabled(container, "SELECT")).toBe(false);expect(container.querySelector('[data-testid="database-resource-selector"]')?.getAttribute("data-readonly")).toBe("true");- await click(radioList[1]!);+ await selectResourceMode(container, "EXPRESSION");- radioList = getRadios(container);- expect(isChecked(radioList[1])).toBe(true);+ expect(selectedResourceMode(container)).toBe("EXPRESSION");expect(container.querySelector('[data-testid="expr-editor"]')@@ -476,9 +492,8 @@ describe("GrantAccessDialog", () => {});await flush();- const radioList = getRadios(container);- expect(isChecked(radioList[1])).toBe(true);- expect(isDisabled(radioList[2])).toBe(false);+ expect(selectedResourceMode(container)).toBe("EXPRESSION");+ expect(isResourceModeDisabled(container, "SELECT")).toBe(false);const exprEditor = container.querySelector('[data-testid="expr-editor"]');expect(exprEditor?.textContent).toContain("serialized-selection");@@ -490,25 +505,22 @@ describe("GrantAccessDialog", () => {const { container, unmount } = renderGrantAccessDialog();await flush();- let radioList = getRadios(container);- expect(isChecked(radioList[2])).toBe(true);- expect(isDisabled(radioList[2])).toBe(false);+ expect(selectedResourceMode(container)).toBe("SELECT");+ expect(isResourceModeDisabled(container, "SELECT")).toBe(false);- await click(radioList[1]!);+ await selectResourceMode(container, "EXPRESSION");await click(container.querySelector<HTMLElement>('[data-testid="expr-editor-set-column-scope"]')!);- radioList = getRadios(container);- expect(isChecked(radioList[1])).toBe(true);- expect(isDisabled(radioList[2])).toBe(false);+ expect(selectedResourceMode(container)).toBe("EXPRESSION");+ expect(isResourceModeDisabled(container, "SELECT")).toBe(false);- await click(radioList[2]!);+ await selectResourceMode(container, "SELECT");- radioList = getRadios(container);- expect(isChecked(radioList[2])).toBe(true);+ expect(selectedResourceMode(container)).toBe("SELECT");expect(container.querySelector('[data-testid="database-resource-selector"]')@@ -558,24 +570,19 @@ describe("GrantAccessDialog", () => {const { container, unmount } = renderGrantAccessDialog();await flush();- const radioList = getRadios(container);-- expect(isChecked(radioList[2])).toBe(true);+ expect(selectedResourceMode(container)).toBe("SELECT");- await click(radioList[1]!);+ await selectResourceMode(container, "EXPRESSION");await flush();- const pendingRadioList = getRadios(container);- expect(isDisabled(pendingRadioList[0])).toBe(true);- expect(isDisabled(pendingRadioList[1])).toBe(true);- expect(isDisabled(pendingRadioList[2])).toBe(true);+ expect(+ resourceModeValues.every((value) => isResourceModeDisabled(container, value))+ ).toBe(true);pendingConversion.resolve([{ parsed: true }]);await flush();- const refreshedRadioList = getRadios(container);- expect(isChecked(refreshedRadioList[1])).toBe(true);- expect(isChecked(refreshedRadioList[2])).toBe(false);+ expect(selectedResourceMode(container)).toBe("EXPRESSION");expect(container.querySelector('[data-testid="expr-editor"]')).toBeTruthy();unmount();@@ -649,9 +656,8 @@ describe("GrantAccessDialog — composite exemption precedence (BYT-9791)", () =const { container, unmount } = renderGrantAccessDialog();await flush();- // Default mode for a non-column-scoped selection is SELECT (radio index 2).- const radios = getRadios(container);- expect(isChecked(radios[2])).toBe(true);+ // Default mode for a non-column-scoped selection is SELECT.+ expect(selectedResourceMode(container)).toBe("SELECT");await click(container.querySelector<HTMLElement>('[data-testid="set-two-resources"]')!diff --git a/frontend/src/routes/project/issue-detail/components/IssueDetailTaskRolloutActionPanel.tsx b/frontend/src/routes/project/issue-detail/components/IssueDetailTaskRolloutActionPanel.tsxindex 0ffef41278..d12a9ad8d7 100644--- a/frontend/src/routes/project/issue-detail/components/IssueDetailTaskRolloutActionPanel.tsx+++ b/frontend/src/routes/project/issue-detail/components/IssueDetailTaskRolloutActionPanel.tsx@@ -9,7 +9,6 @@ import { DatabaseTargetDisplay } from "@/components/DatabaseTargetDisplay";import { TaskStatusIcon } from "@/components/TaskStatusIcon";import { Button } from "@/components/ui/button";import { Checkbox } from "@/components/ui/checkbox";-import { RadioGroup, RadioGroupItem } from "@/components/ui/radio-group";import {Sheet,SheetBody,@@ -18,6 +17,7 @@ import {SheetHeader,SheetTitle,} from "@/components/ui/sheet";+import { Switch } from "@/components/ui/switch";import { Textarea } from "@/components/ui/textarea";import { useCurrentUser } from "@/hooks/useAppState";import { useProjectByName } from "@/hooks/useProjectByName";@@ -369,24 +369,17 @@ export function IssueDetailTaskRolloutActionPanel({<h3 className="mb-1 font-medium text-control">{t("task.execution-time")}</h3>- <RadioGroup- className="flex! flex-col gap-2 sm:flex-row sm:gap-4"- onValueChange={(value) =>- setRunTimeInMS(- value === "immediate"- ? undefined- : Date.now() + DEFAULT_RUN_DELAY_MS- )- }- value={runTimeInMS === undefined ? "immediate" : "scheduled"}- >- <RadioGroupItem value="immediate">- {t("task.run-immediately.self")}- </RadioGroupItem>- <RadioGroupItem value="scheduled">- {t("task.schedule-for-later.self")}- </RadioGroupItem>- </RadioGroup>+ <label className="flex items-center gap-x-2 text-sm">+ <Switch+ checked={runTimeInMS !== undefined}+ onCheckedChange={(checked) =>+ setRunTimeInMS(+ checked ? Date.now() + DEFAULT_RUN_DELAY_MS : undefined+ )+ }+ />+ <span>{t("task.schedule-for-later.self")}</span>+ </label><div className="mt-1 text-sm text-control-light">{runTimeInMS === undefined? t("task.run-immediately.description")diff --git a/frontend/src/routes/project/plan-detail/components/PlanDetailTaskRolloutActionPanel.tsx b/frontend/src/routes/project/plan-detail/components/PlanDetailTaskRolloutActionPanel.tsxindex 8e7625ae79..08449cebf0 100644--- a/frontend/src/routes/project/plan-detail/components/PlanDetailTaskRolloutActionPanel.tsx+++ b/frontend/src/routes/project/plan-detail/components/PlanDetailTaskRolloutActionPanel.tsx@@ -8,7 +8,6 @@ import { listAllTaskRuns } from "@/api/taskRun";import { TaskStatusIcon } from "@/components/TaskStatusIcon";import { Button } from "@/components/ui/button";import { Checkbox } from "@/components/ui/checkbox";-import { RadioGroup, RadioGroupItem } from "@/components/ui/radio-group";import {Sheet,SheetBody,@@ -17,6 +16,7 @@ import {SheetHeader,SheetTitle,} from "@/components/ui/sheet";+import { Switch } from "@/components/ui/switch";import { Textarea } from "@/components/ui/textarea";import { Tooltip } from "@/components/ui/tooltip";import { useCurrentUser } from "@/hooks/useAppState";@@ -359,24 +359,17 @@ export function PlanDetailTaskRolloutActionPanel({<h3 className="mb-1 font-medium text-control">{t("task.execution-time")}</h3>- <RadioGroup- className="flex! flex-col gap-2 sm:flex-row sm:gap-4"- onValueChange={(value) =>- setRunTimeInMS(- value === "immediate"- ? undefined- : Date.now() + DEFAULT_RUN_DELAY_MS- )- }- value={runTimeInMS === undefined ? "immediate" : "scheduled"}- >- <RadioGroupItem value="immediate">- {t("task.run-immediately.self")}- </RadioGroupItem>- <RadioGroupItem value="scheduled">- {t("task.schedule-for-later.self")}- </RadioGroupItem>- </RadioGroup>+ <label className="flex items-center gap-x-2 text-sm">+ <Switch+ checked={runTimeInMS !== undefined}+ onCheckedChange={(checked) =>+ setRunTimeInMS(+ checked ? Date.now() + DEFAULT_RUN_DELAY_MS : undefined+ )+ }+ />+ <span>{t("task.schedule-for-later.self")}</span>+ </label><div className="mt-1 text-sm text-control-light">{runTimeInMS === undefined? t("task.run-immediately.description")diff --git a/frontend/src/routes/workspace/EnvironmentsPage.tsx b/frontend/src/routes/workspace/EnvironmentsPage.tsxindex 39eba7368a..ae3e35c2b8 100644--- a/frontend/src/routes/workspace/EnvironmentsPage.tsx+++ b/frontend/src/routes/workspace/EnvironmentsPage.tsx@@ -772,7 +772,7 @@ function EnvironmentDetail({}><label className="inline-flex items-center gap-x-2 cursor-pointer">- <Checkbox+ <Switchchecked={editProtected}disabled={!canEdit}onCheckedChange={(checked) => setEditProtected(checked)}@@ -1077,7 +1077,7 @@ function CreateSheet({}><label className="inline-flex items-center gap-x-2 cursor-pointer">- <Checkbox+ <Switchchecked={isProtected}onCheckedChange={(checked) => setIsProtected(checked)}/>diff --git a/frontend/src/routes/workspace/IDPDetailPage.tsx b/frontend/src/routes/workspace/IDPDetailPage.tsxindex c04fa8f7ad..7e647f08d2 100644--- a/frontend/src/routes/workspace/IDPDetailPage.tsx+++ b/frontend/src/routes/workspace/IDPDetailPage.tsx@@ -15,9 +15,9 @@ import {AlertDialogTitle,} from "@/components/ui/alert-dialog";import { Button } from "@/components/ui/button";-import { Checkbox } from "@/components/ui/checkbox";import { Input } from "@/components/ui/input";import { RadioGroup, RadioGroupItem } from "@/components/ui/radio-group";+import { Switch } from "@/components/ui/switch";import {WorkspacePageInfo,WorkspacePageLayout,@@ -286,7 +286,7 @@ function ProviderConfigForm({{t("settings.sso.form.security-options")}</label><label className="flex items-center gap-x-2 cursor-pointer">- <Checkbox+ <Switchchecked={configForOAuth2.skipTlsVerify}onCheckedChange={(checked) =>onUpdateOAuth2({@@ -426,7 +426,7 @@ function ProviderConfigForm({{t("settings.sso.form.security-options")}</label><label className="flex items-center gap-x-2 cursor-pointer">- <Checkbox+ <Switchchecked={configForOIDC.skipTlsVerify}onCheckedChange={(checked) =>onUpdateOIDC({@@ -623,7 +623,7 @@ function ProviderConfigForm({{t("settings.sso.form.security-options")}</label><label className="flex items-center gap-x-2 cursor-pointer">- <Checkbox+ <Switchchecked={configForLDAP.skipTlsVerify}onCheckedChange={(checked) =>onUpdateLDAP({diff --git a/frontend/src/routes/workspace/IDPsPage.tsx b/frontend/src/routes/workspace/IDPsPage.tsxindex 25ec193ebf..d00d45da98 100644--- a/frontend/src/routes/workspace/IDPsPage.tsx+++ b/frontend/src/routes/workspace/IDPsPage.tsx@@ -3,11 +3,7 @@ import { Code, ConnectError } from "@connectrpc/connect";import { cva } from "class-variance-authority";import {ArrowRight,- Building,Database,- GitBranch,- GitFork,- Globe,Info,Key,Plus,@@ -26,11 +22,17 @@ import {type ResourceIdFieldRef,} from "@/components/ResourceIdField";import { Button } from "@/components/ui/button";-import { Checkbox } from "@/components/ui/checkbox";import { CopyButton } from "@/components/ui/copy-button";import { FormField, FormFieldGroup, FormTitle } from "@/components/ui/form";import { Input } from "@/components/ui/input";import { RadioGroup, RadioGroupItem } from "@/components/ui/radio-group";+import {+ Select,+ SelectContent,+ SelectItem,+ SelectTrigger,+ SelectValue,+} from "@/components/ui/select";import {Sheet,SheetBody,@@ -40,6 +42,7 @@ import {SheetTitle,} from "@/components/ui/sheet";import { StepIndicator } from "@/components/ui/step-indicator";+import { Switch } from "@/components/ui/switch";import {Table,TableBody,@@ -396,7 +399,7 @@ function ProviderConfigForm({<FormField title={<>{t("settings.sso.form.security-options")}</>}><label className="flex items-center gap-x-2 cursor-pointer">- <Checkbox+ <Switchchecked={configForOAuth2.skipTlsVerify}onCheckedChange={(checked) =>onUpdateOAuth2({@@ -539,7 +542,7 @@ function ProviderConfigForm({<FormField title={<>{t("settings.sso.form.security-options")}</>}><label className="flex items-center gap-x-2 cursor-pointer">- <Checkbox+ <Switchchecked={configForOIDC.skipTlsVerify}onCheckedChange={(checked) =>onUpdateOIDC({@@ -744,7 +747,7 @@ function ProviderConfigForm({<FormField title={<>{t("settings.sso.form.security-options")}</>}><label className="flex items-center gap-x-2 cursor-pointer">- <Checkbox+ <Switchchecked={configForLDAP.skipTlsVerify}onCheckedChange={(checked) =>onUpdateLDAP({@@ -1018,21 +1021,6 @@ function getProviderIcon(type: IdentityProviderType) {}}-function getTemplateIcon(title: string) {- switch (title.toLowerCase()) {- case "google":- return Globe;- case "github":- return GitBranch;- case "gitlab":- return GitFork;- case "microsoft entra":- return Building;- default:- return Key;- }-}-function CreateWizardDrawer({onClose,onCreated,@@ -1495,8 +1483,7 @@ function CreateWizardDrawer({{t("settings.sso.form.template-description")}</p></div>- <RadioGroup- className="max-w-3xl mx-auto grid grid-cols-1 sm:grid-cols-2 gap-4"+ <Selectvalue={selectedTemplate?.title ?? ""}onValueChange={(value) => {const template = templateList.find(@@ -1510,44 +1497,30 @@ function CreateWizardDrawer({}}}>- {templateList.map((tmpl) => {- const Icon = getTemplateIcon(tmpl.title);- const hasFeature = useAppStore- .getState()- .hasFeature(tmpl.feature);- return (- <div+ <SelectTrigger className="mx-auto w-full max-w-3xl">+ <SelectValue placeholder={t("common.select")}>+ {selectedTemplate?.title}+ </SelectValue>+ </SelectTrigger>+ <SelectContent>+ {templateList.map((tmpl) => (+ <SelectItemkey={tmpl.title}- className={selectionCardVariants({- selected: selectedTemplate?.title === tmpl.title,- disabled: !hasFeature,- })}- onClick={() => {- if (hasFeature) {- applyTemplate(tmpl);- }- }}+ value={tmpl.title}+ disabled={+ !useAppStore.getState().hasFeature(tmpl.feature)+ }>- <div className="flex items-center gap-x-3">- <RadioGroupItem- value={tmpl.title}- aria-label={tmpl.title}- disabled={!hasFeature}- />- <Icon className="size-8 shrink-0" strokeWidth={1} />- <div className="flex-1">- <span className="font-medium text-base text-main">- {tmpl.title}- </span>- <p className="text-control-light text-sm">- {getTemplateDescription(tmpl.title)}- </p>- </div>- </div>- </div>- );- })}- </RadioGroup>+ {tmpl.title}+ </SelectItem>+ ))}+ </SelectContent>+ </Select>+ {selectedTemplate && (+ <p className="mx-auto w-full max-w-3xl text-sm text-control-light">+ {getTemplateDescription(selectedTemplate.title)}+ </p>+ )}</div>)}diff --git a/frontend/src/routes/workspace/SQLReviewPage.tsx b/frontend/src/routes/workspace/SQLReviewPage.tsxindex dd01ef2058..ecbea54fbb 100644--- a/frontend/src/routes/workspace/SQLReviewPage.tsx+++ b/frontend/src/routes/workspace/SQLReviewPage.tsx@@ -11,8 +11,8 @@ import { LearnMoreLink } from "@/components/LearnMoreLink";import { ResourceLink } from "@/components/sql-review/ResourceLink";import { Badge } from "@/components/ui/badge";import { Button } from "@/components/ui/button";-import { Checkbox } from "@/components/ui/checkbox";import { SearchInput } from "@/components/ui/search-input";+import { Switch } from "@/components/ui/switch";import {Table,TableBody,@@ -122,7 +122,7 @@ function PolicyTable({<TableCell>{policy.ruleList.length}</TableCell><TableCell>{hasUpdatePermission ? (- <Checkbox+ <Switchchecked={policy.enforce}onCheckedChange={(checked) =>toggleEnabled(policy, checked)diff --git a/frontend/src/routes/workspace/general/AIAugmentationSection.tsx b/frontend/src/routes/workspace/general/AIAugmentationSection.tsxindex 6da1c8dd7b..5c169822a2 100644--- a/frontend/src/routes/workspace/general/AIAugmentationSection.tsx+++ b/frontend/src/routes/workspace/general/AIAugmentationSection.tsx@@ -14,7 +14,6 @@ import { ComponentPermissionGuard } from "@/components/ComponentPermissionGuard"import { LearnMoreLink } from "@/components/LearnMoreLink";import { PermissionGuard } from "@/components/PermissionGuard";import { Alert } from "@/components/ui/alert";-import { Checkbox } from "@/components/ui/checkbox";import { FormField, FormFieldGroup, FormSection } from "@/components/ui/form";import { Input } from "@/components/ui/input";import {@@ -24,6 +23,7 @@ import {SelectTrigger,SelectValue,} from "@/components/ui/select";+import { Switch } from "@/components/ui/switch";import { useServerState } from "@/hooks/useAppState";import {AI_ASSISTANT_PRODUCT_INTRO,@@ -296,7 +296,7 @@ export const AIAugmentationSection = forwardRef<<FormFieldtitle={<span className="flex items-center gap-x-2">- <Checkbox+ <Switchchecked={state.enabled}disabled={!canEdit}onCheckedChange={(checked) => toggleEnabled(checked)}diff --git a/frontend/src/routes/workspace/general/AccountSection.tsx b/frontend/src/routes/workspace/general/AccountSection.tsxindex d32d2740df..764b29fa5b 100644--- a/frontend/src/routes/workspace/general/AccountSection.tsx+++ b/frontend/src/routes/workspace/general/AccountSection.tsx@@ -22,6 +22,7 @@ import { FormField, FormFieldGroup, FormSection } from "@/components/ui/form";import { Input } from "@/components/ui/input";import { NumberInput } from "@/components/ui/number-input";import { RadioGroup, RadioGroupItem } from "@/components/ui/radio-group";+import { Switch } from "@/components/ui/switch";import { usePlanFeature, useServerState } from "@/hooks/useAppState";import { useAppStore } from "@/stores/app";import {@@ -423,7 +424,7 @@ export const AccountSection = forwardRef<SectionHandle, AccountSectionProps>(<FormFieldtitle={<span className="flex items-center gap-x-2">- <Checkbox+ <Switchchecked={toggleState.disallowSignup}disabled={disabled || !hasDisallowSignupFeature}onCheckedChange={(checked) =>@@ -626,7 +627,7 @@ export const AccountSection = forwardRef<SectionHandle, AccountSectionProps>(<FormFieldtitle={<span className="flex items-center gap-x-2">- <Checkbox+ <Switchchecked={toggleState.requireMfa}disabled={disabled || !has2FAFeature}onCheckedChange={(checked) =>@@ -650,7 +651,7 @@ export const AccountSection = forwardRef<SectionHandle, AccountSectionProps>(<FormFieldtitle={<span className="flex items-center gap-x-2">- <Checkbox+ <Switchchecked={toggleState.disallowPasswordSignin}disabled={disabled ||@@ -696,7 +697,7 @@ export const AccountSection = forwardRef<SectionHandle, AccountSectionProps>(<FormFieldtitle={<span className="flex items-center gap-x-2">- <Checkbox+ <Switchchecked={toggleState.allowEmailCodeSignin}disabled={disabled ||diff --git a/frontend/src/routes/workspace/general/AnnouncementSection.tsx b/frontend/src/routes/workspace/general/AnnouncementSection.tsxindex 8bed1915f1..e7ae9cc61c 100644--- a/frontend/src/routes/workspace/general/AnnouncementSection.tsx+++ b/frontend/src/routes/workspace/general/AnnouncementSection.tsx@@ -32,7 +32,13 @@ import {FormSection,} from "@/components/ui/form";import { Input } from "@/components/ui/input";-import { SegmentedControl } from "@/components/ui/segmented-control";+import {+ Select,+ SelectContent,+ SelectItem,+ SelectTrigger,+ SelectValue,+} from "@/components/ui/select";import { usePlanFeature } from "@/hooks/useAppState";import { useAppStore } from "@/stores/app";import {@@ -193,18 +199,29 @@ export const AnnouncementSection = forwardRef<"settings.general.workspace.announcement-theme.description")}>- <SegmentedControl- ariaLabel={t(- "settings.general.workspace.announcement-theme.self"- )}+ <Selectdisabled={disabled}value={selectedTheme}- onValueChange={onSelectTheme}- options={THEME_OPTIONS.map((option) => ({- value: option,- label: themeOptionLabel(option),- }))}- />+ onValueChange={(value) => {+ if (value) onSelectTheme(value);+ }}+ >+ <SelectTrigger+ aria-label={t(+ "settings.general.workspace.announcement-theme.self"+ )}+ className="w-full sm:w-80"+ >+ <SelectValue>{themeOptionLabel(selectedTheme)}</SelectValue>+ </SelectTrigger>+ <SelectContent>+ {THEME_OPTIONS.map((option) => (+ <SelectItem key={option} value={option}>+ {themeOptionLabel(option)}+ </SelectItem>+ ))}+ </SelectContent>+ </Select>{selectedTheme === "custom" && (<FormControlGroup>diff --git a/frontend/src/routes/workspace/general/AuditLogSection.tsx b/frontend/src/routes/workspace/general/AuditLogSection.tsxindex 4940ad15da..d3c5be7400 100644--- a/frontend/src/routes/workspace/general/AuditLogSection.tsx+++ b/frontend/src/routes/workspace/general/AuditLogSection.tsx@@ -10,8 +10,8 @@ import {} from "react";import { useTranslation } from "react-i18next";import { FeatureBadge } from "@/components/FeatureBadge";-import { Checkbox } from "@/components/ui/checkbox";import { FormField, FormFieldGroup, FormSection } from "@/components/ui/form";+import { Switch } from "@/components/ui/switch";import { usePlanFeature } from "@/hooks/useAppState";import { useAppStore } from "@/stores/app";import { PlanFeature } from "@/types/proto-es/v1/subscription_service_pb";@@ -90,7 +90,7 @@ export const AuditLogSection = forwardRef<SectionHandle, AuditLogSectionProps>(<FormFieldtitle={<span className="flex items-start gap-x-3">- <Checkbox+ <Switchchecked={state.enableAuditLogStdout}className="mt-1"disabled={!allowEdit || !hasAuditLogFeature}@@ -113,7 +113,7 @@ export const AuditLogSection = forwardRef<SectionHandle, AuditLogSectionProps>(<FormFieldtitle={<span className="flex items-start gap-x-3">- <Checkbox+ <Switchchecked={state.enableDebug}className="mt-1"disabled={!allowEdit}diff --git a/frontend/src/routes/workspace/general/ProductImprovementSection.tsx b/frontend/src/routes/workspace/general/ProductImprovementSection.tsxindex a1aa5da6e1..dc18963426 100644--- a/frontend/src/routes/workspace/general/ProductImprovementSection.tsx+++ b/frontend/src/routes/workspace/general/ProductImprovementSection.tsx@@ -8,8 +8,8 @@ import {useState,} from "react";import { useTranslation } from "react-i18next";-import { Checkbox } from "@/components/ui/checkbox";import { FormField, FormFieldGroup, FormSection } from "@/components/ui/form";+import { Switch } from "@/components/ui/switch";import { useAppStore } from "@/stores/app";import type { SectionHandle } from "./useSettingSection";@@ -73,7 +73,7 @@ export const ProductImprovementSection = forwardRef<<FormFieldtitle={<span className="flex items-start gap-x-3">- <Checkbox+ <Switchchecked={state.enableMetricCollection}className="mt-1"disabled={!allowEdit}diff --git a/frontend/src/routes/workspace/general/SQLEditorSection.test.tsx b/frontend/src/routes/workspace/general/SQLEditorSection.test.tsxindex ffe39db107..ce420941f0 100644--- a/frontend/src/routes/workspace/general/SQLEditorSection.test.tsx+++ b/frontend/src/routes/workspace/general/SQLEditorSection.test.tsx@@ -1,4 +1,4 @@-import { act, createRef, type ReactElement } from "react";+import { act, createRef, type ReactElement, type ReactNode } from "react";import { createRoot, type Root } from "react-dom/client";import { afterEach, beforeEach, describe, expect, test, vi } from "vitest";@@ -116,6 +116,35 @@ vi.mock("@/components/PermissionGuard", () => ({),}));+vi.mock("@/components/ui/select", () => ({+ Select: ({+ children,+ disabled,+ onValueChange,+ value,+ }: {+ children: ReactNode;+ disabled?: boolean;+ onValueChange?: (value: string) => void;+ value?: string;+ }) => (+ <select+ data-testid="theme-select"+ disabled={disabled}+ onChange={(event) => onValueChange?.(event.target.value)}+ value={value}+ >+ {children}+ </select>+ ),+ SelectContent: ({ children }: { children: ReactNode }) => <>{children}</>,+ SelectItem: ({ children, value }: { children: ReactNode; value: string }) => (+ <option value={value}>{children}</option>+ ),+ SelectTrigger: ({ children }: { children: ReactNode }) => <>{children}</>,+ SelectValue: () => null,+}));+// The theme preview/editor import SQLEditorThemeScope etc.; render them as-is.const storeState = {@@ -171,10 +200,15 @@ afterEach(() => {container.remove();});-function querySegment(label: string): HTMLElement | undefined {- // Segment labels render their text; find the clickable label by text.- const labels = Array.from(container.querySelectorAll("label"));- return labels.find((l) => l.textContent?.trim() === label);+function selectTheme(value: string) {+ const select = container.querySelector<HTMLSelectElement>(+ '[data-testid="theme-select"]'+ );+ expect(select).toBeTruthy();+ act(() => {+ select!.value = value;+ select!.dispatchEvent(new Event("change", { bubbles: true }));+ });}describe("SQLEditorSection theme", () => {@@ -186,13 +220,7 @@ describe("SQLEditorSection theme", () => {expect(ref.current?.isDirty()).toBe(false);- // Pick the "dark" preset (preset.name === "Dark").- const darkSegment = querySegment("Default Dark");- expect(darkSegment).toBeTruthy();- const radio = darkSegment?.querySelector("input");- act(() => {- radio?.click();- });+ selectTheme("dark");expect(ref.current?.isDirty()).toBe(true);@@ -220,11 +248,7 @@ describe("SQLEditorSection theme", () => {<SQLEditorSection ref={ref} title="SQL Editor" onDirtyChange={() => {}} />);- const darkSegment = querySegment("Default Dark");- expect(darkSegment).toBeTruthy();- act(() => {- darkSegment?.querySelector("input")?.click();- });+ selectTheme("dark");await act(async () => {await ref.current?.update();@@ -239,14 +263,7 @@ describe("SQLEditorSection theme", () => {<SQLEditorSection ref={ref} title="SQL Editor" onDirtyChange={() => {}} />);- const customSegment = querySegment(- "settings.general.workspace.sql-editor-theme.custom"- );- expect(customSegment).toBeTruthy();- const radio = customSegment?.querySelector("input");- act(() => {- radio?.click();- });+ selectTheme("__custom__");expect(ref.current?.isDirty()).toBe(true);@@ -301,10 +318,7 @@ describe("SQLEditorSection theme", () => {<SQLEditorSection ref={ref} title="SQL Editor" onDirtyChange={() => {}} />);- const darkSegment = querySegment("Default Dark");- act(() => {- darkSegment?.querySelector("input")?.click();- });+ selectTheme("dark");expect(ref.current?.isDirty()).toBe(true);act(() => {@@ -320,8 +334,9 @@ describe("SQLEditorSection theme", () => {<SQLEditorSection ref={ref} title="SQL Editor" onDirtyChange={() => {}} />);- const lightSegment = querySegment("Default Light");- expect(lightSegment?.querySelector('[data-state="checked"]')).toBeTruthy();+ expect(+ container.querySelector<HTMLSelectElement>('[data-testid="theme-select"]')+ ).toHaveValue("light");// The default selection must not register as a pending change.expect(ref.current?.isDirty()).toBe(false);});@@ -335,20 +350,15 @@ describe("SQLEditorSection theme", () => {<SQLEditorSection ref={ref} title="SQL Editor" onDirtyChange={() => {}} />);- const group = container.querySelector('[role="radiogroup"]');- // SegmentedControl renders radios; when disabled they carry data-disabled.- const anyDisabled = container.querySelector("input[data-disabled]");- expect(group || anyDisabled).toBeTruthy();- expect(anyDisabled).toBeTruthy();+ expect(+ container.querySelector<HTMLSelectElement>('[data-testid="theme-select"]')+ ).toBeDisabled();});});-// The data-export policy control was reworked from a bare "Enable data-// export" checkbox (no description) to "Allow data export without approval"-// + a description naming the access-grant path — customers read the old-// title as a hard kill switch and never found approval-gated export.-// These tests lock the retitled key pair and the `checked={!disableExport}`-// inversion the new title depends on.+// The data-export policy is stored as `disableExport`, while the control names+// the inverse allowed state. Keep that inversion and its explanatory copy in+// sync.describe("SQLEditorSection data-export policy toggle", () => {function renderSection() {const ref = createRef<SectionHandle>();@@ -358,16 +368,16 @@ describe("SQLEditorSection data-export policy toggle", () => {return ref;}- function exportCheckbox(): HTMLElement {- // The checkbox renders inside the FormField title span, as a sibling of+ function exportSwitch(): HTMLElement {+ // The switch renders inside the FormField title span, as a sibling of// the label text (SQLEditorSection.tsx) — scope by that span.const span = Array.from(container.querySelectorAll("span")).find((s) =>s.textContent?.includes("settings.general.workspace.data-export.self"));expect(span).toBeTruthy();- const box = span?.querySelector<HTMLElement>('[role="checkbox"]');- expect(box).toBeTruthy();- return box as HTMLElement;+ const control = span?.querySelector<HTMLElement>('[role="switch"]');+ expect(control).toBeTruthy();+ return control as HTMLElement;}test("renders the retitled label with its description", () => {@@ -383,23 +393,23 @@ describe("SQLEditorSection data-export policy toggle", () => {test("export allowed without approval (disableExport=false) renders checked", () => {mocks.policy.disableExport = false;renderSection();- expect(exportCheckbox().getAttribute("aria-checked")).toBe("true");+ expect(exportSwitch().getAttribute("aria-checked")).toBe("true");});test("approval-gated export (disableExport=true) renders unchecked", () => {mocks.policy.disableExport = true;renderSection();- expect(exportCheckbox().getAttribute("aria-checked")).toBe("false");+ expect(exportSwitch().getAttribute("aria-checked")).toBe("false");});- test("toggling the checkbox marks the section dirty for the Update bar", () => {+ test("toggling the switch marks the section dirty for the Update bar", () => {mocks.policy.disableExport = false;const ref = renderSection();expect(ref.current?.isDirty()).toBe(false);act(() => {- exportCheckbox().click();+ exportSwitch().click();});expect(ref.current?.isDirty()).toBe(true);- expect(exportCheckbox().getAttribute("aria-checked")).toBe("false");+ expect(exportSwitch().getAttribute("aria-checked")).toBe("false");});});diff --git a/frontend/src/routes/workspace/general/SQLEditorSection.tsx b/frontend/src/routes/workspace/general/SQLEditorSection.tsxindex 20c31ef4b6..63353f02da 100644--- a/frontend/src/routes/workspace/general/SQLEditorSection.tsx+++ b/frontend/src/routes/workspace/general/SQLEditorSection.tsx@@ -18,10 +18,16 @@ import {getAvailableEditorThemes,} from "@/components/monaco/editorThemes";import { PermissionGuard } from "@/components/PermissionGuard";-import { Checkbox } from "@/components/ui/checkbox";import { FormField, FormFieldGroup, FormSection } from "@/components/ui/form";import { NumberInput } from "@/components/ui/number-input";-import { SegmentedControl } from "@/components/ui/segmented-control";+import {+ Select,+ SelectContent,+ SelectItem,+ SelectTrigger,+ SelectValue,+} from "@/components/ui/select";+import { Switch } from "@/components/ui/switch";import { usePlanFeature, useWorkspaceResourceName } from "@/hooks/useAppState";import {deriveThemeFromAnchors,@@ -421,7 +427,7 @@ export const SQLEditorSection = forwardRef<<FormFieldtitle={<span className="w-full inline-flex items-center gap-x-2">- <Checkbox+ <Switchchecked={!state.disableExport}disabled={!canUpdatePolicy || !hasQueryPolicyFeature}onCheckedChange={(checked) =>@@ -443,7 +449,7 @@ export const SQLEditorSection = forwardRef<<FormFieldtitle={<span className="w-full inline-flex items-center gap-x-2">- <Checkbox+ <Switchchecked={!state.disableCopyData}disabled={!canUpdatePolicy || !hasRestrictCopyingDataFeature}onCheckedChange={(checked) =>@@ -464,7 +470,7 @@ export const SQLEditorSection = forwardRef<<FormFieldtitle={<span className="w-full inline-flex items-center gap-x-2">- <Checkbox+ <Switchchecked={state.allowAdminDataSource}disabled={!canUpdatePolicy || !hasQueryPolicyFeature}onCheckedChange={(checked) =>@@ -612,24 +618,36 @@ export const SQLEditorSection = forwardRef<"settings.general.workspace.sql-editor-theme.description")}>- <SegmentedControl- ariaLabel={t("settings.general.workspace.sql-editor-theme.self")}+ <Selectdisabled={!canSetWorkspaceProfile}value={isCustomSelected ? CUSTOM_THEME_OPTION : selectedThemeId}- onValueChange={handleSelectTheme}- options={[- ...PRESETS.map((preset) => ({- value: preset.id,- label: preset.name,- })),- {- value: CUSTOM_THEME_OPTION,- label: t(- "settings.general.workspace.sql-editor-theme.custom"- ),- },- ]}- />+ onValueChange={(value) => {+ if (value) handleSelectTheme(value);+ }}+ >+ <SelectTrigger+ aria-label={t(+ "settings.general.workspace.sql-editor-theme.self"+ )}+ className="w-full sm:w-80"+ >+ <SelectValue>+ {isCustomSelected+ ? t("settings.general.workspace.sql-editor-theme.custom")+ : PRESET_BY_ID[selectedThemeId]?.name}+ </SelectValue>+ </SelectTrigger>+ <SelectContent>+ {PRESETS.map((preset) => (+ <SelectItem key={preset.id} value={preset.id}>+ {preset.name}+ </SelectItem>+ ))}+ <SelectItem value={CUSTOM_THEME_OPTION}>+ {t("settings.general.workspace.sql-editor-theme.custom")}+ </SelectItem>+ </SelectContent>+ </Select>{isCustomSelected && customDraft && (<ThemeAnchorEditordiff --git a/frontend/src/routes/workspace/general/SecuritySection.tsx b/frontend/src/routes/workspace/general/SecuritySection.tsxindex c9c46cba15..4f288ab1bd 100644--- a/frontend/src/routes/workspace/general/SecuritySection.tsx+++ b/frontend/src/routes/workspace/general/SecuritySection.tsx@@ -19,9 +19,9 @@ import {usePermissionCheck,} from "@/components/PermissionGuard";import { Button } from "@/components/ui/button";-import { Checkbox } from "@/components/ui/checkbox";import { FormField, FormFieldGroup, FormSection } from "@/components/ui/form";import { Input } from "@/components/ui/input";+import { Switch } from "@/components/ui/switch";import { usePlanFeature } from "@/hooks/useAppState";import {DOMAIN_RESTRICTION_PRODUCT_INTRO,@@ -305,7 +305,7 @@ export const SecuritySection = forwardRef<SectionHandle, SecuritySectionProps>(</span></div><label className="flex items-center gap-x-2">- <Checkbox+ <Switchchecked={expiration.neverExpire}disabled={!canEdit}onCheckedChange={(checked) =>@@ -341,7 +341,7 @@ export const SecuritySection = forwardRef<SectionHandle, SecuritySectionProps>(<FormFieldtitle={<span className="flex items-center gap-x-2">- <Checkbox+ <Switchchecked={state.enableWatermark}disabled={!canEdit || !hasWatermarkFeature}onCheckedChange={(checked) =>@@ -423,12 +423,12 @@ export const SecuritySection = forwardRef<SectionHandle, SecuritySectionProps>())}</div>- {/* Enforce restriction checkbox */}+ {/* Enforce restriction toggle */}<div className="w-full flex flex-row justify-between items-center"><FormFieldtitle={<div className="flex items-start gap-x-2">- <Checkbox+ <Switcharia-describedby={membersRestrictionDescriptionId}aria-labelledby={membersRestrictionLabelId}checked={state.enableRestriction}diff --git a/frontend/src/routes/workspace/mcp/MCPAccessPolicySection.test.tsx b/frontend/src/routes/workspace/mcp/MCPAccessPolicySection.test.tsxindex e38f10adae..90dbe956d4 100644--- a/frontend/src/routes/workspace/mcp/MCPAccessPolicySection.test.tsx+++ b/frontend/src/routes/workspace/mcp/MCPAccessPolicySection.test.tsx@@ -116,6 +116,21 @@ const clickText = (container: HTMLElement, text: string) => {});};+const selectCapability = (container: HTMLElement, value: number) => {+ const capabilities = [+ MCPSetting_Capability.DISABLED,+ MCPSetting_Capability.READ_ONLY,+ MCPSetting_Capability.READ_WRITE,+ ];+ const radio = container.querySelectorAll<HTMLElement>('[role="radio"]')[+ capabilities.indexOf(value)+ ];+ expect(radio).toBeTruthy();+ act(() => {+ radio!.click();+ });+};+beforeEach(async () => {vi.clearAllMocks();mocks.permissionDisabled.value = false;@@ -154,7 +169,7 @@ describe("MCPAccessPolicySection", () => {expect(mocks.useUnsavedChangesGuard).toHaveBeenLastCalledWith(false);// Picking a different ceiling is the unsaved edit that must be guarded.- clickText(container, "settings.mcp.policy.mode.disabled.title");+ selectCapability(container, MCPSetting_Capability.DISABLED);await flush();expect(mocks.useUnsavedChangesGuard).toHaveBeenLastCalledWith(true);@@ -223,7 +238,7 @@ describe("MCPAccessPolicySection", () => {"settings.mcp.policy.unreadable.pick");- clickText(container, "settings.mcp.policy.mode.read-write.title");+ selectCapability(container, MCPSetting_Capability.READ_WRITE);await flush();clickText(container, "settings.mcp.policy.save");await flush();@@ -287,6 +302,10 @@ describe("MCPAccessPolicySection", () => {clickText(container, "settings.mcp.policy.edit");await flush();+ const radios = container.querySelectorAll('[role="radio"]');+ expect(radios).toHaveLength(3);+ expect(radios[1]).toHaveAttribute("aria-checked", "true");+const bestForLines = () =>[...container.querySelectorAll("p")].filter((line) =>line.textContent?.includes(".best-for")@@ -305,6 +324,21 @@ describe("MCPAccessPolicySection", () => {unmount();});+ test("keeps the masking switch intrinsic", async () => {+ const { container, render, unmount } = renderIntoContainer(+ <MCPAccessPolicySection />+ );+ render();+ await flush();+ clickText(container, "settings.mcp.policy.edit");+ await flush();++ expect(maskingSwitch(container)?.classList.contains("shrink-0")).toBe(+ true+ );+ unmount();+ });+test("the policy inputs are locked while a save is in flight", async () => {const inFlight = Promise.withResolvers<undefined>();mocks.upsertSetting.mockReturnValue(inFlight.promise);@@ -459,16 +493,12 @@ describe("MCPAccessPolicySection", () => {clickText(container, "settings.mcp.policy.mode.disabled.title");await flush();- expect(- maskingSwitch(container)- ).toBeNull();+ expect(maskingSwitch(container)).toBeNull();// Picking a serving mode again brings the control back.clickText(container, "settings.mcp.policy.mode.read-write.title");await flush();- expect(- maskingSwitch(container)- ).not.toBeNull();+ expect(maskingSwitch(container)).not.toBeNull();unmount();});