mirror of
https://github.com/awatertrevi/infisical.git
synced 2026-10-06 09:26:47 +00:00
Fix: UI secret import indicator
This commit is contained in:
@@ -264,12 +264,13 @@ export const useGetImportedSecretsAllEnvs = ({
|
|||||||
});
|
});
|
||||||
|
|
||||||
const isImportedSecretPresentInEnv = useCallback(
|
const isImportedSecretPresentInEnv = useCallback(
|
||||||
(secPath: string, envSlug: string) => {
|
(secPath: 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(
|
||||||
({ secretPath }) => secretPath === secPath
|
({ secretPath, ...rest }) =>
|
||||||
|
secretPath === secPath && rest.secrets.some((s) => s.key === secretName)
|
||||||
);
|
);
|
||||||
|
|
||||||
return Boolean(isPresent);
|
return Boolean(isPresent);
|
||||||
|
|||||||
+3
-2
@@ -27,7 +27,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) => boolean;
|
isImportedSecretPresentInEnv: (name: string, env: string, secretName: string) => boolean;
|
||||||
};
|
};
|
||||||
|
|
||||||
export const SecretOverviewTableRow = ({
|
export const SecretOverviewTableRow = ({
|
||||||
@@ -65,7 +65,8 @@ 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);
|
const isSecretImported = isImportedSecretPresentInEnv(secretPath, slug, secretKey);
|
||||||
|
|
||||||
const isSecretPresent = Boolean(secret);
|
const isSecretPresent = Boolean(secret);
|
||||||
const isSecretEmpty = secret?.value === "";
|
const isSecretEmpty = secret?.value === "";
|
||||||
return (
|
return (
|
||||||
|
|||||||
Reference in New Issue
Block a user