mirror of
https://github.com/awatertrevi/infisical.git
synced 2026-10-10 07:28:50 +00:00
feat: removed trailing slash from secret input and fixed overview not showing nested imported secrets
This commit is contained in:
@@ -78,7 +78,8 @@ export const SecretPathInput = ({
|
|||||||
const validPaths = inputValue.split("/");
|
const validPaths = inputValue.split("/");
|
||||||
validPaths.pop();
|
validPaths.pop();
|
||||||
|
|
||||||
const newValue = `${validPaths.join("/")}/${suggestions[selectedIndex]}/`;
|
// removed trailing slash
|
||||||
|
const newValue = `${validPaths.join("/")}/${suggestions[selectedIndex]}`;
|
||||||
onChange?.(newValue);
|
onChange?.(newValue);
|
||||||
setInputValue(newValue);
|
setInputValue(newValue);
|
||||||
setSecretPath(newValue);
|
setSecretPath(newValue);
|
||||||
|
|||||||
@@ -264,13 +264,12 @@ export const useGetImportedSecretsAllEnvs = ({
|
|||||||
});
|
});
|
||||||
|
|
||||||
const isImportedSecretPresentInEnv = useCallback(
|
const isImportedSecretPresentInEnv = useCallback(
|
||||||
(secPath: string, envSlug: string, secretName: string) => {
|
(envSlug: string, secretName: string) => {
|
||||||
const selectedEnvIndex = environments.indexOf(envSlug);
|
const selectedEnvIndex = environments.indexOf(envSlug);
|
||||||
|
|
||||||
if (selectedEnvIndex !== -1) {
|
if (selectedEnvIndex !== -1) {
|
||||||
const isPresent = secretImports?.[selectedEnvIndex]?.data?.find(
|
const isPresent = secretImports?.[selectedEnvIndex]?.data?.find(({ secrets }) =>
|
||||||
({ secretPath, secrets }) =>
|
secrets.some((s) => s.key === secretName)
|
||||||
secretPath === secPath && secrets.some((s) => s.key === secretName)
|
|
||||||
);
|
);
|
||||||
|
|
||||||
return Boolean(isPresent);
|
return Boolean(isPresent);
|
||||||
|
|||||||
+5
-11
@@ -29,7 +29,7 @@ type Props = {
|
|||||||
onSecretCreate: (env: string, key: string, value: string) => Promise<void>;
|
onSecretCreate: (env: string, key: string, value: string) => Promise<void>;
|
||||||
onSecretUpdate: (env: string, key: string, value: string, secretId?: string) => Promise<void>;
|
onSecretUpdate: (env: string, key: string, value: string, secretId?: string) => Promise<void>;
|
||||||
onSecretDelete: (env: string, key: string, secretId?: string) => Promise<void>;
|
onSecretDelete: (env: string, key: string, secretId?: string) => Promise<void>;
|
||||||
isImportedSecretPresentInEnv: (name: string, env: string, secretName: string) => boolean;
|
isImportedSecretPresentInEnv: (env: string, secretName: string) => boolean;
|
||||||
};
|
};
|
||||||
|
|
||||||
export const SecretOverviewTableRow = ({
|
export const SecretOverviewTableRow = ({
|
||||||
@@ -53,8 +53,7 @@ export const SecretOverviewTableRow = ({
|
|||||||
<>
|
<>
|
||||||
<Tr isHoverable isSelectable onClick={() => setIsFormExpanded.toggle()} className="group">
|
<Tr isHoverable isSelectable onClick={() => setIsFormExpanded.toggle()} className="group">
|
||||||
<Td
|
<Td
|
||||||
className={`sticky left-0 z-10 bg-mineshaft-800 bg-clip-padding py-0 px-0 group-hover:bg-mineshaft-700 ${
|
className={`sticky left-0 z-10 bg-mineshaft-800 bg-clip-padding py-0 px-0 group-hover:bg-mineshaft-700 ${isFormExpanded && "border-t-2 border-mineshaft-500"
|
||||||
isFormExpanded && "border-t-2 border-mineshaft-500"
|
|
||||||
}`}
|
}`}
|
||||||
>
|
>
|
||||||
<div className="h-full w-full border-r border-mineshaft-600 py-2.5 px-5">
|
<div className="h-full w-full border-r border-mineshaft-600 py-2.5 px-5">
|
||||||
@@ -83,7 +82,7 @@ export const SecretOverviewTableRow = ({
|
|||||||
{environments.map(({ slug }, i) => {
|
{environments.map(({ slug }, i) => {
|
||||||
const secret = getSecretByKey(slug, secretKey);
|
const secret = getSecretByKey(slug, secretKey);
|
||||||
|
|
||||||
const isSecretImported = isImportedSecretPresentInEnv(secretPath, slug, secretKey);
|
const isSecretImported = isImportedSecretPresentInEnv(slug, secretKey);
|
||||||
|
|
||||||
const isSecretPresent = Boolean(secret);
|
const isSecretPresent = Boolean(secret);
|
||||||
const isSecretEmpty = secret?.value === "";
|
const isSecretEmpty = secret?.value === "";
|
||||||
@@ -133,8 +132,7 @@ export const SecretOverviewTableRow = ({
|
|||||||
<Tr>
|
<Tr>
|
||||||
<Td
|
<Td
|
||||||
colSpan={totalCols}
|
colSpan={totalCols}
|
||||||
className={`bg-bunker-600 px-0 py-0 ${
|
className={`bg-bunker-600 px-0 py-0 ${isFormExpanded && "border-b-2 border-mineshaft-500"
|
||||||
isFormExpanded && "border-b-2 border-mineshaft-500"
|
|
||||||
}`}
|
}`}
|
||||||
>
|
>
|
||||||
<div
|
<div
|
||||||
@@ -180,11 +178,7 @@ export const SecretOverviewTableRow = ({
|
|||||||
const secret = getSecretByKey(slug, secretKey);
|
const secret = getSecretByKey(slug, secretKey);
|
||||||
const isCreatable = !secret;
|
const isCreatable = !secret;
|
||||||
|
|
||||||
const isImportedSecret = isImportedSecretPresentInEnv(
|
const isImportedSecret = isImportedSecretPresentInEnv(slug, secretKey);
|
||||||
secretPath,
|
|
||||||
slug,
|
|
||||||
secretKey
|
|
||||||
);
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<tr
|
<tr
|
||||||
|
|||||||
Reference in New Issue
Block a user