Feat: Show overwritten value in secret overview and allow for edits

This commit is contained in:
Daniel Hougaard
2024-06-21 15:23:09 +02:00
parent dc0fe6920c
commit c43a18904d

View File

@@ -10,24 +10,33 @@ import { IconButton, Tooltip } from "@app/components/v2";
import { InfisicalSecretInput } from "@app/components/v2/InfisicalSecretInput";
import { ProjectPermissionActions, ProjectPermissionSub } from "@app/context";
import { useToggle } from "@app/hooks";
import { SecretType } from "@app/hooks/api/types";
type Props = {
defaultValue?: string | null;
secretName: string;
secretId?: string;
isOverride?: boolean;
isCreatable?: boolean;
isVisible?: boolean;
isImportedSecret: boolean;
environment: string;
secretPath: string;
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,
type?: SecretType,
secretId?: string
) => Promise<void>;
onSecretDelete: (env: string, key: string, secretId?: string) => Promise<void>;
};
export const SecretEditRow = ({
defaultValue,
isCreatable,
isOverride,
isImportedSecret,
onSecretUpdate,
secretName,
@@ -73,7 +82,13 @@ export const SecretEditRow = ({
if (isCreatable) {
await onSecretCreate(environment, secretName, value);
} else {
await onSecretUpdate(environment, secretName, value, secretId);
await onSecretUpdate(
environment,
secretName,
value,
isOverride ? SecretType.Personal : SecretType.Shared,
secretId
);
}
}
reset({ value });