mirror of
https://github.com/awatertrevi/infisical.git
synced 2026-09-22 13:39:35 +00:00
improvements: resolve more commit state issues form value reveal change
This commit is contained in:
@@ -272,13 +272,7 @@ export const useGetSecretVersion = (dto: GetSecretVersionsDTO) =>
|
||||
|
||||
export const fetchSecretVersionValue = async (secretId: string, version: number) => {
|
||||
const { data } = await apiRequest.get<TSecretVersionValue>(
|
||||
`/api/v1/dashboard/secret-versions/${secretId}/value/${version}`,
|
||||
{
|
||||
params: {
|
||||
secretId,
|
||||
version
|
||||
}
|
||||
}
|
||||
`/api/v1/dashboard/secret-versions/${secretId}/value/${version}`
|
||||
);
|
||||
return data.value;
|
||||
};
|
||||
|
||||
@@ -29,7 +29,7 @@ export const SecretOverviewRotationSecretRow = ({
|
||||
|
||||
const { data: secretValueData, isError } = useGetSecretValue(
|
||||
{
|
||||
secretKey: secret!.key,
|
||||
secretKey: secret?.key ?? "",
|
||||
environment,
|
||||
secretPath,
|
||||
projectId: currentProject.id
|
||||
|
||||
@@ -117,7 +117,7 @@ export const SecretEditRow = ({
|
||||
? {
|
||||
environment: importedSecret.environment,
|
||||
secretPath: importedSecret.secretPath,
|
||||
secretKey: importedSecret.secret!.key,
|
||||
secretKey: importedSecret.secret?.key ?? "",
|
||||
projectId: currentProject.id
|
||||
}
|
||||
: {
|
||||
|
||||
@@ -143,7 +143,7 @@ const RenderSecretChanges = ({ onDiscard, change }: RenderResourceProps) => {
|
||||
{
|
||||
version: 1, // placeholder, not used
|
||||
secretKey,
|
||||
secretValue
|
||||
secretValue: secretValue || undefined
|
||||
}
|
||||
]
|
||||
}}
|
||||
|
||||
@@ -126,7 +126,10 @@ export const SecretItem = memo(
|
||||
const [isFieldFocused, setIsFieldFocused] = useToggle();
|
||||
const queryClient = useQueryClient();
|
||||
|
||||
const canFetchSecretValue = !originalSecret.secretValueHidden && !originalSecret.isEmpty;
|
||||
const canFetchSecretValue =
|
||||
!originalSecret.secretValueHidden &&
|
||||
!originalSecret.isEmpty &&
|
||||
pendingAction !== PendingAction.Create;
|
||||
|
||||
const fetchSecretValueParams = {
|
||||
environment,
|
||||
@@ -508,13 +511,15 @@ export const SecretItem = memo(
|
||||
control={control}
|
||||
render={({ field }) => (
|
||||
<SecretInput
|
||||
isLoadingValue={isLoadingSecretValue}
|
||||
isLoadingValue={isLoadingSecretValue && Boolean(secret.idOverride)}
|
||||
isErrorLoadingValue={isErrorFetchingSecretValue}
|
||||
key="value-overriden"
|
||||
isVisible={isVisible}
|
||||
isReadOnly={isReadOnly}
|
||||
{...field}
|
||||
onFocus={() => setIsFieldFocused.on()}
|
||||
onFocus={() => {
|
||||
if (secret.idOverride) setIsFieldFocused.on();
|
||||
}}
|
||||
onBlur={() => {
|
||||
setIsFieldFocused.off();
|
||||
field.onBlur();
|
||||
|
||||
@@ -27,7 +27,7 @@ export const SecretRotationSecretRow = ({
|
||||
{
|
||||
environment,
|
||||
secretPath,
|
||||
secretKey: secret!.key,
|
||||
secretKey: secret?.key ?? "",
|
||||
projectId: currentProject.id
|
||||
},
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user