From 43cac055116f8d1faaf3091ec49175e17435240a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=94=90=E5=B0=8F=E9=B8=AD?= Date: Fri, 28 Aug 2026 18:04:24 +0800 Subject: [PATCH] fix: render select labels before dropdown opens base-ui's Select.Value falls back to the raw option value when no items mapping or children are provided, so selects whose option labels differ from their values (translated or human-readable labels) showed the raw value (e.g. "vault-transit", "async", "Ki") until the dropdown was first opened. Pass the current label as SelectValue children, falling back to the placeholder when no value is selected, across the SSE KMS backend select, bucket policy/encryption/KMS-key selects, lifecycle object version selects, site replication sync/TLS selects, and bucket replication mode/TLS/bandwidth-unit selects. Selects whose labels equal their values (event ARNs, storage classes, lifecycle tiers, pagination sizes) are unchanged. --- app/(dashboard)/sse/page.tsx | 11 +++++++++- components/buckets/info.tsx | 26 ++++++++++++++++++++--- components/lifecycle/new-form.tsx | 8 +++++-- components/replication/edit-form.tsx | 12 ++++++++--- components/replication/new-form.tsx | 12 ++++++++--- components/site-replication/edit-form.tsx | 14 ++++++++++-- components/site-replication/new-form.tsx | 8 ++++++- 7 files changed, 76 insertions(+), 15 deletions(-) diff --git a/app/(dashboard)/sse/page.tsx b/app/(dashboard)/sse/page.tsx index 89ec4288..e7c3f1e1 100644 --- a/app/(dashboard)/sse/page.tsx +++ b/app/(dashboard)/sse/page.tsx @@ -936,6 +936,13 @@ export default function SSEPage() { : t("Changing KMS service state may briefly interrupt SSE requests.") const isPendingDefaultKey = pendingKeyAction?.key.key_id === status?.config_summary?.default_key_id + const backendTypeLabels: Record = { + unsupported: t("Unsupported KMS backend"), + local: t("Local filesystem"), + "vault-kv2": t("HashiCorp Vault KV2"), + "vault-transit": t("HashiCorp Vault Transit Engine"), + static: t("Static single-key (built-in)"), + } const mutationLocked = Boolean(activeMutation || statusError || loadingStatus) const unsupportedKmsReadOnly = formState.backendType === "unsupported" const staticKmsReadOnly = hasConfiguration && formState.backendType === "static" @@ -1160,7 +1167,9 @@ export default function SSEPage() { disabled={formDisabled || localKmsConfigured} > - + + {backendTypeLabels[formState.backendType] ?? null} + {formState.backendType === "unsupported" ? ( diff --git a/components/buckets/info.tsx b/components/buckets/info.tsx index 6e0fa3fa..26972780 100644 --- a/components/buckets/info.tsx +++ b/components/buckets/info.tsx @@ -714,6 +714,17 @@ export function BucketInfo({ bucketName }: BucketInfoProps) { { href: "#automation", label: t("Automation") }, ] + const policyLabels: Partial> = { + public: t("Public"), + private: t("Private"), + custom: t("Custom"), + } + const encryptionTypeLabels: Record = { + disabled: t("Disabled"), + "SSE-KMS": "SSE-KMS", + "SSE-S3": "SSE-S3", + } + if (initialLoading) { return (
@@ -1074,7 +1085,9 @@ export function BucketInfo({ bucketName }: BucketInfoProps) { }} > - + + {policyLabels[policyFormPolicy] ?? policyFormPolicy} + {t("Public")} @@ -1150,7 +1163,9 @@ export function BucketInfo({ bucketName }: BucketInfoProps) { setVersionType(value ?? "")}> - + + {versionOptions.find((opt) => opt.value === versionType)?.label ?? null} + {versionOptions.map((opt) => ( @@ -548,7 +550,9 @@ export function LifecycleNewForm({ open, onOpenChange, bucketName, onSuccess }: setSyncState(value as SiteReplicationSyncState)}> - + {syncStateLabels[syncState] ?? null} {t("Enabled")} @@ -202,7 +212,7 @@ export function SiteReplicationEditForm({ open, onOpenChange, peer, onSuccess }: disabled={saving} > - + {tlsModeLabels[tlsMode]} {t("Default certificate verification")} diff --git a/components/site-replication/new-form.tsx b/components/site-replication/new-form.tsx index 67d13ced..ed37c802 100644 --- a/components/site-replication/new-form.tsx +++ b/components/site-replication/new-form.tsx @@ -216,6 +216,12 @@ export function SiteReplicationNewForm({ resetForm() } + const tlsModeLabels: Record = { + verify: t("Default certificate verification"), + "custom-ca": t("Custom CA certificate"), + skip: t("Skip TLS verification"), + } + return ( - + {tlsModeLabels[tlsModes[index] ?? "verify"]} {t("Default certificate verification")}