fix: make settings controls editable

This commit is contained in:
2026-07-02 08:25:07 -07:00
parent 67fcb8fabd
commit 89a59956ac
5 changed files with 196 additions and 152 deletions

View File

@@ -71,73 +71,86 @@ export function OrganizationDetailClient({
</CardHeader>
<CardContent>
<form className="grid gap-4" onSubmit={handleSettingsSubmit}>
<label className="flex items-center justify-between gap-4 rounded-md border p-3 text-sm">
<span>
<span className="block font-medium"></span>
<span className="block text-xs text-muted-foreground">使</span>
</span>
<div className="rounded-md border p-3 text-sm">
<Checkbox
aria-label="开放公开注册"
controlFirst={false}
defaultChecked={organization.registrationEnabled}
label={
<span className="min-w-0">
<span className="block font-medium"></span>
<span className="block text-xs text-muted-foreground">使</span>
</span>
}
name="registrationEnabled"
/>
</label>
<label className="flex items-center justify-between gap-4 rounded-md border p-3 text-sm">
<span>
<span className="block font-medium"> OIDC </span>
<span className="block text-xs text-muted-foreground"> OIDC </span>
</span>
<Checkbox aria-label="启用 OIDC 登录" defaultChecked={organization.oidcEnabled} name="oidcEnabled" />
</label>
<div className="grid gap-3 md:grid-cols-2">
<label className="grid gap-2 text-sm">
<span className="font-medium">Issuer URL</span>
<Input defaultValue={organization.oidcIssuerUrl} name="oidcIssuerUrl" placeholder="https://idp.example.com" />
</label>
<label className="grid gap-2 text-sm">
<span className="font-medium">Client ID</span>
<Input defaultValue={organization.oidcClientId} name="oidcClientId" />
</label>
</div>
<label className="grid gap-2 text-sm">
<span className="font-medium">Client Secret</span>
<Input
name="oidcClientSecret"
placeholder={organization.oidcHasClientSecret ? "已配置,留空则不修改" : "未配置"}
type="password"
/>
</label>
<div className="grid gap-3 md:grid-cols-2">
<label className="grid gap-2 text-sm">
<span className="font-medium">Scopes</span>
<Input defaultValue={organization.oidcScopes} name="oidcScopes" placeholder="openid profile email" />
</label>
<label className="grid gap-2 text-sm">
<span className="font-medium">Redirect URI</span>
<Input defaultValue={organization.oidcRedirectUri} name="oidcRedirectUri" placeholder="/api/auth/oidc/callback" />
</label>
</div>
<label className="grid gap-2 text-sm">
<span className="font-medium">Avatar Claim</span>
<Input defaultValue={organization.oidcAvatarClaim} name="oidcAvatarClaim" placeholder="picture" />
</label>
<label className="flex items-center justify-between gap-4 rounded-md border p-3 text-sm">
<span>
<span className="block font-medium">OIDC </span>
<span className="block text-xs text-muted-foreground"> OIDC </span>
</span>
<div className="rounded-md border p-3 text-sm">
<Checkbox
aria-label="OIDC 自动开户"
controlFirst={false}
defaultChecked={organization.oidcEnabled}
label={
<span className="min-w-0">
<span className="block font-medium"> OIDC </span>
<span className="block text-xs text-muted-foreground"> OIDC </span>
</span>
}
name="oidcEnabled"
/>
</div>
<div className="grid gap-3 md:grid-cols-2">
<Input
defaultValue={organization.oidcIssuerUrl}
label="Issuer URL"
name="oidcIssuerUrl"
placeholder="https://idp.example.com"
/>
<Input defaultValue={organization.oidcClientId} label="Client ID" name="oidcClientId" />
</div>
<Input
label="Client Secret"
name="oidcClientSecret"
placeholder={organization.oidcHasClientSecret ? "已配置,留空则不修改" : "未配置"}
type="password"
/>
<div className="grid gap-3 md:grid-cols-2">
<Input
defaultValue={organization.oidcScopes}
label="Scopes"
name="oidcScopes"
placeholder="openid profile email"
/>
<Input
defaultValue={organization.oidcRedirectUri}
label="Redirect URI"
name="oidcRedirectUri"
placeholder="/api/auth/oidc/callback"
/>
</div>
<Input
defaultValue={organization.oidcAvatarClaim}
label="Avatar Claim"
name="oidcAvatarClaim"
placeholder="picture"
/>
<div className="rounded-md border p-3 text-sm">
<Checkbox
controlFirst={false}
defaultChecked={organization.oidcAutoProvision}
label={
<span className="min-w-0">
<span className="block font-medium">OIDC </span>
<span className="block text-xs text-muted-foreground"> OIDC </span>
</span>
}
name="oidcAutoProvision"
/>
</label>
</div>
{settingsMessage ? (
<p className="rounded-md bg-secondary px-3 py-2 text-sm text-secondary-foreground" role="status">