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