mirror of
https://github.com/coder/coder.git
synced 2026-09-24 15:04:27 +08:00
feat(site): clarify why secret name is disabled when editing (#26553)
Adds helper text under the disabled `Name` field in the Edit secret
dialog so users understand why it can't be changed:
> Unique identifier (can’t be changed).
Matches the existing pattern used elsewhere (e.g. AI settings). The
secret name is the resource identifier in the API path (`PATCH
/api/v2/users/{user}/secrets/{name}`) and `UpdateUserSecretRequest` has
no `name` field, so rename isn't supported server-side.
Created on behalf of @matifali.
---------
Co-authored-by: blink-so[bot] <211532188+blink-so[bot]@users.noreply.github.com>
This commit is contained in:
co-authored by
blink-so[bot]
parent
a1ec9df345
commit
4691ef39cd
@@ -233,7 +233,11 @@ const SecretFields: FC<SecretFieldsProps> = ({
|
||||
return (
|
||||
<>
|
||||
<FormField
|
||||
field={getFieldHelpers("name")}
|
||||
field={getFieldHelpers("name", {
|
||||
helperText: disableName
|
||||
? "Unique identifier (can’t be changed)."
|
||||
: undefined,
|
||||
})}
|
||||
label={
|
||||
showRequiredLabels ? (
|
||||
<RequiredFieldLabel>Name</RequiredFieldLabel>
|
||||
|
||||
@@ -298,6 +298,9 @@ export const EditDialogOpened: Story = {
|
||||
).toBeInTheDocument();
|
||||
await expect(dialogView.getByLabelText("Name")).toHaveValue(secret.name);
|
||||
await expect(dialogView.getByLabelText("Name")).toBeDisabled();
|
||||
await expect(
|
||||
dialogView.getByText("Unique identifier (can’t be changed)."),
|
||||
).toBeInTheDocument();
|
||||
await expect(dialogView.getByLabelText("Description")).toHaveValue(
|
||||
secret.description,
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user