fix: display connection names and select labels in pipeline form

This commit is contained in:
tigerenwork 2026-08-09 20:35:21 +08:00
parent 1ad5a4d4d6
commit a8b6539476
1 changed files with 18 additions and 4 deletions

View File

@ -214,7 +214,12 @@ export function PipelineForm({ initial }: { initial?: Pipeline }) {
}}
>
<SelectTrigger className="w-full">
<SelectValue placeholder="选择源连接" />
<SelectValue placeholder="选择源连接">
{(v) => {
const c = connections.find((x) => String(x.id) === String(v));
return c ? `${c.name}${c.database}` : String(v ?? "");
}}
</SelectValue>
</SelectTrigger>
<SelectContent>
{connections.map((c) => (
@ -229,7 +234,12 @@ export function PipelineForm({ initial }: { initial?: Pipeline }) {
<Label></Label>
<Select value={targetId} onValueChange={(v) => setTargetId(String(v))}>
<SelectTrigger className="w-full">
<SelectValue placeholder="选择目标连接" />
<SelectValue placeholder="选择目标连接">
{(v) => {
const c = connections.find((x) => String(x.id) === String(v));
return c ? `${c.name}${c.database}` : String(v ?? "");
}}
</SelectValue>
</SelectTrigger>
<SelectContent>
{connections.map((c) => (
@ -245,7 +255,9 @@ export function PipelineForm({ initial }: { initial?: Pipeline }) {
<Label></Label>
<Select value={mode} onValueChange={(v) => setMode(String(v))}>
<SelectTrigger className="w-full">
<SelectValue />
<SelectValue>
{(v) => MODES.find((m) => m.value === v)?.label ?? String(v ?? "")}
</SelectValue>
</SelectTrigger>
<SelectContent>
{MODES.map((m) => (
@ -282,7 +294,9 @@ export function PipelineForm({ initial }: { initial?: Pipeline }) {
disabled={!schemaSync}
>
<SelectTrigger className="w-36">
<SelectValue />
<SelectValue>
{(v) => (v === "all" ? "整个库" : "仅选中的表")}
</SelectValue>
</SelectTrigger>
<SelectContent>
<SelectItem value="selected"></SelectItem>