mirror of
https://github.com/awatertrevi/infisical.git
synced 2026-09-22 13:39:35 +00:00
Merge pull request #4676 from Infisical/fix/overviewEditRowFetchSecret
Fix secret value fetching to prioritize folder secrets over imported ones
This commit is contained in:
@@ -82,6 +82,7 @@ type Props = {
|
|||||||
isImported: boolean;
|
isImported: boolean;
|
||||||
}[];
|
}[];
|
||||||
}[];
|
}[];
|
||||||
|
isSecretPresent?: boolean;
|
||||||
};
|
};
|
||||||
|
|
||||||
export const SecretEditRow = ({
|
export const SecretEditRow = ({
|
||||||
@@ -101,7 +102,8 @@ export const SecretEditRow = ({
|
|||||||
isRotatedSecret,
|
isRotatedSecret,
|
||||||
importedBy,
|
importedBy,
|
||||||
importedSecret,
|
importedSecret,
|
||||||
isEmpty
|
isEmpty,
|
||||||
|
isSecretPresent
|
||||||
}: Props) => {
|
}: Props) => {
|
||||||
const { handlePopUpOpen, handlePopUpToggle, handlePopUpClose, popUp } = usePopUp([
|
const { handlePopUpOpen, handlePopUpToggle, handlePopUpClose, popUp } = usePopUp([
|
||||||
"editSecret"
|
"editSecret"
|
||||||
@@ -113,20 +115,21 @@ export const SecretEditRow = ({
|
|||||||
|
|
||||||
const [isFieldFocused, setIsFieldFocused] = useToggle();
|
const [isFieldFocused, setIsFieldFocused] = useToggle();
|
||||||
|
|
||||||
const fetchSecretValueParams = importedSecret
|
const fetchSecretValueParams =
|
||||||
? {
|
importedSecret && !isSecretPresent
|
||||||
environment: importedSecret.environment,
|
? {
|
||||||
secretPath: importedSecret.secretPath,
|
environment: importedSecret.environment,
|
||||||
secretKey: importedSecret.secret?.key ?? "",
|
secretPath: importedSecret.secretPath,
|
||||||
projectId: currentProject.id
|
secretKey: importedSecret.secret?.key ?? "",
|
||||||
}
|
projectId: currentProject.id
|
||||||
: {
|
}
|
||||||
environment,
|
: {
|
||||||
secretPath,
|
environment,
|
||||||
secretKey: secretName,
|
secretPath,
|
||||||
projectId: currentProject.id,
|
secretKey: secretName,
|
||||||
isOverride
|
projectId: currentProject.id,
|
||||||
};
|
isOverride
|
||||||
|
};
|
||||||
|
|
||||||
// scott: only fetch value if secret exists, has non-empty value and user has permission
|
// scott: only fetch value if secret exists, has non-empty value and user has permission
|
||||||
const canFetchValue = Boolean(importedSecret ?? secretId) && !isEmpty && !secretValueHidden;
|
const canFetchValue = Boolean(importedSecret ?? secretId) && !isEmpty && !secretValueHidden;
|
||||||
|
|||||||
@@ -284,6 +284,7 @@ export const SecretOverviewTableRow = ({
|
|||||||
environment={slug}
|
environment={slug}
|
||||||
isRotatedSecret={secret?.isRotatedSecret}
|
isRotatedSecret={secret?.isRotatedSecret}
|
||||||
importedBy={importedBy}
|
importedBy={importedBy}
|
||||||
|
isSecretPresent={Boolean(secret)}
|
||||||
/>
|
/>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|||||||
Reference in New Issue
Block a user