Skip to content

Commit ee97547

Browse files
fix(settings): keep Secrets read-only under a project scope
Review round 2: a project or checkout scope stays selected on the Secrets page, but providers are environment-wide. Show them read-only with the same notice environment-wide settings rows use. Co-Authored-By: Claude Opus 5.5 <[email protected]>
1 parent c1c1ede commit ee97547

1 file changed

Lines changed: 14 additions & 3 deletions

File tree

‎apps/web/src/components/settings/SecretsSettings.tsx‎

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,11 +37,15 @@ const SECRET_PROVIDER_KINDS: Readonly<
3737
};
3838

3939
export function SecretsSettingsPanel() {
40-
const { environment } = useSettingsScope();
40+
const { scope, environment } = useSettingsScope();
4141
return (
4242
<SettingsPageContainer>
4343
{environment?.connection.phase === "connected" ? (
44-
<EnvironmentSecretProviders key={environment.environmentId} environment={environment} />
44+
<EnvironmentSecretProviders
45+
key={environment.environmentId}
46+
environment={environment}
47+
projectScoped={scope.kind === "project" || scope.kind === "checkout"}
48+
/>
4549
) : (
4650
<SettingsSection {...searchableSetting("secret-providers")}>
4751
<p className="px-4 py-3 text-sm text-muted-foreground">
@@ -55,8 +59,10 @@ export function SecretsSettingsPanel() {
5559

5660
function EnvironmentSecretProviders({
5761
environment,
62+
projectScoped,
5863
}: {
5964
readonly environment: EnvironmentPresentation;
65+
readonly projectScoped: boolean;
6066
}) {
6167
const environmentId = environment.environmentId;
6268
const sessionState = useEnvironmentSessionState(environmentId);
@@ -70,7 +76,7 @@ function EnvironmentSecretProviders({
7076
hasError: sessionState.hasError,
7177
}),
7278
});
73-
const readOnly = access.kind !== "editable";
79+
const readOnly = access.kind !== "editable" || projectScoped;
7480
const providers = useEnvironmentSettings(environmentId, (settings) => settings.secretProviders);
7581
const updateSettings = useUpdateEnvironmentSettings(environmentId);
7682
const [dialog, setDialog] = useState<
@@ -95,6 +101,11 @@ function EnvironmentSecretProviders({
95101
) : null
96102
}
97103
>
104+
{projectScoped ? (
105+
<p className="px-4 pt-3 text-xs text-muted-foreground">
106+
Environment-wide setting. Select an environment to change it.
107+
</p>
108+
) : null}
98109
{entries.length === 0 ? (
99110
<SettingsRow
100111
title="No secret providers configured."

0 commit comments

Comments
 (0)