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

@@ -65,29 +65,47 @@ export function GlobalSettingsClient({ settings }: GlobalSettingsClientProps): R
<CardDescription> OIDC </CardDescription>
</CardHeader>
<CardContent className="grid gap-4">
<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>
<Checkbox aria-label="开放公开注册" defaultChecked={settings.registrationEnabled} name="registrationEnabled" />
</label>
<div className="rounded-md border p-3 text-sm">
<Checkbox
controlFirst={false}
defaultChecked={settings.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"
/>
</div>
<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={settings.oidcEnabled} name="oidcEnabled" />
</label>
<div className="rounded-md border p-3 text-sm">
<Checkbox
controlFirst={false}
defaultChecked={settings.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>
<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={settings.oidcAutoProvision} name="oidcAutoProvision" />
</label>
<div className="rounded-md border p-3 text-sm">
<Checkbox
controlFirst={false}
defaultChecked={settings.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"
/>
</div>
</CardContent>
</Card>
@@ -101,40 +119,33 @@ export function GlobalSettingsClient({ settings }: GlobalSettingsClientProps): R
</CardHeader>
<CardContent className="grid gap-4">
<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={settings.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={settings.oidcClientId} name="oidcClientId" />
</label>
<Input
defaultValue={settings.oidcIssuerUrl}
label="Issuer URL"
name="oidcIssuerUrl"
placeholder="https://idp.example.com"
/>
<Input defaultValue={settings.oidcClientId} label="Client ID" name="oidcClientId" />
</div>
<label className="grid gap-2 text-sm">
<span className="font-medium">Client Secret</span>
<Input
name="oidcClientSecret"
placeholder={settings.oidcHasClientSecret ? "已配置,留空则不修改" : "未配置"}
type="password"
/>
</label>
<Input
label="Client Secret"
name="oidcClientSecret"
placeholder={settings.oidcHasClientSecret ? "已配置,留空则不修改" : "未配置"}
type="password"
/>
<div className="grid gap-3 md:grid-cols-2">
<label className="grid gap-2 text-sm">
<span className="font-medium">Scopes</span>
<Input defaultValue={settings.oidcScopes} name="oidcScopes" placeholder="openid profile email" />
</label>
<label className="grid gap-2 text-sm">
<span className="font-medium">Redirect URI</span>
<Input defaultValue={settings.oidcRedirectUri} name="oidcRedirectUri" placeholder="/api/auth/oidc/callback" />
</label>
<Input defaultValue={settings.oidcScopes} label="Scopes" name="oidcScopes" placeholder="openid profile email" />
<Input
defaultValue={settings.oidcRedirectUri}
label="Redirect URI"
name="oidcRedirectUri"
placeholder="/api/auth/oidc/callback"
/>
</div>
<label className="grid gap-2 text-sm">
<span className="font-medium">Avatar Claim</span>
<Input defaultValue={settings.oidcAvatarClaim} name="oidcAvatarClaim" placeholder="picture" />
</label>
<Input defaultValue={settings.oidcAvatarClaim} label="Avatar Claim" name="oidcAvatarClaim" placeholder="picture" />
{message ? (
<p className="rounded-md bg-secondary px-3 py-2 text-sm text-secondary-foreground" role="status">