refactor: remove console logs and enhance tooltip information in CreateSecretForm

This commit is contained in:
Victor Santos
2025-11-05 11:24:02 -03:00
parent 7b83481815
commit 10aace268e
4 changed files with 21 additions and 12 deletions

View File

@@ -344,11 +344,6 @@ export const InfisicalSecretInput = forwardRef<HTMLTextAreaElement, Props>(
} }
); );
console.log("canReadSecretValue", canReadSecretValue);
console.log("propEnvironment", propEnvironment);
console.log("propSecretPath", propSecretPath);
console.log("segment", segment);
if (!canReadSecretValue) { if (!canReadSecretValue) {
createNotification({ createNotification({
text: "You do not have permission to access this secret", text: "You do not have permission to access this secret",
@@ -405,11 +400,6 @@ export const InfisicalSecretInput = forwardRef<HTMLTextAreaElement, Props>(
} }
); );
console.log("canReadSecretValue", canReadSecretValue);
console.log("environmentSlug", environmentSlug);
console.log("secretPath", secretPath);
console.log("secretName", secretName);
if (!canReadSecretValue) { if (!canReadSecretValue) {
createNotification({ createNotification({
text: "You do not have permission to access this secret", text: "You do not have permission to access this secret",
@@ -432,7 +422,7 @@ export const InfisicalSecretInput = forwardRef<HTMLTextAreaElement, Props>(
}) })
}); });
}, },
[navigate, projectId] [navigate, projectId, permission, propEnvironment, propSecretPath]
); );
return ( return (

View File

@@ -153,12 +153,18 @@ export const SecretInput = forwardRef<HTMLTextAreaElement, Props>(
} }
}; };
const handleBlur = () => {
setIsCmdOrCtrlPressed(false);
};
window.addEventListener("keydown", handleKeyDown); window.addEventListener("keydown", handleKeyDown);
window.addEventListener("keyup", handleKeyUp); window.addEventListener("keyup", handleKeyUp);
window.addEventListener("blur", handleBlur);
return () => { return () => {
window.removeEventListener("keydown", handleKeyDown); window.removeEventListener("keydown", handleKeyDown);
window.removeEventListener("keyup", handleKeyUp); window.removeEventListener("keyup", handleKeyUp);
window.removeEventListener("blur", handleBlur);
}; };
}, []); }, []);

View File

@@ -249,6 +249,19 @@ export const CreateSecretForm = ({ secretPath = "/", onClose }: Props) => {
name="value" name="value"
render={({ field }) => ( render={({ field }) => (
<FormControl <FormControl
tooltipText={
<div>
You can add references to other secrets using the format{" "}
<code>
&#36;{"{"}secret_name{"}"}
</code>
.
<br />
<br /> You can go to the referenced secret by holding the <code>Cmd</code> (Mac) or{" "}
<code>Ctrl</code> (Windows/Linux) key and clicking on the secret name.
</div>
}
tooltipClassName="max-w-md"
label="Value" label="Value"
isError={Boolean(errors?.value)} isError={Boolean(errors?.value)}
errorText={errors?.value?.message} errorText={errors?.value?.message}

View File

@@ -602,7 +602,7 @@ const Page = () => {
tags: updatedTags, tags: updatedTags,
include: includeFilter include: includeFilter
})); }));
setDebouncedSearchFilter(routerQueryParams.search as string); setDebouncedSearchFilter((routerQueryParams.search as string) ?? "");
}, [routerQueryParams.search, routerQueryParams.tags, routerQueryParams.filterBy]); }, [routerQueryParams.search, routerQueryParams.tags, routerQueryParams.filterBy]);
const selectedSecrets = useSelectedSecrets(); const selectedSecrets = useSelectedSecrets();