mirror of
https://github.com/awatertrevi/infisical.git
synced 2026-10-02 16:25:52 +00:00
Feat: Indicator for wether or not secrets are imported
This commit is contained in:
+23
-5
@@ -4,6 +4,7 @@ import {
|
|||||||
faCheck,
|
faCheck,
|
||||||
faEye,
|
faEye,
|
||||||
faEyeSlash,
|
faEyeSlash,
|
||||||
|
faFileImport,
|
||||||
faKey,
|
faKey,
|
||||||
faXmark
|
faXmark
|
||||||
} from "@fortawesome/free-solid-svg-icons";
|
} from "@fortawesome/free-solid-svg-icons";
|
||||||
@@ -26,6 +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;
|
||||||
};
|
};
|
||||||
|
|
||||||
export const SecretOverviewTableRow = ({
|
export const SecretOverviewTableRow = ({
|
||||||
@@ -36,6 +38,7 @@ export const SecretOverviewTableRow = ({
|
|||||||
onSecretUpdate,
|
onSecretUpdate,
|
||||||
onSecretCreate,
|
onSecretCreate,
|
||||||
onSecretDelete,
|
onSecretDelete,
|
||||||
|
isImportedSecretPresentInEnv,
|
||||||
expandableColWidth
|
expandableColWidth
|
||||||
}: Props) => {
|
}: Props) => {
|
||||||
const [isFormExpanded, setIsFormExpanded] = useToggle();
|
const [isFormExpanded, setIsFormExpanded] = useToggle();
|
||||||
@@ -61,6 +64,8 @@ export const SecretOverviewTableRow = ({
|
|||||||
</Td>
|
</Td>
|
||||||
{environments.map(({ slug }, i) => {
|
{environments.map(({ slug }, i) => {
|
||||||
const secret = getSecretByKey(slug, secretKey);
|
const secret = getSecretByKey(slug, secretKey);
|
||||||
|
|
||||||
|
const isSecretImported = isImportedSecretPresentInEnv(secretPath, slug);
|
||||||
const isSecretPresent = Boolean(secret);
|
const isSecretPresent = Boolean(secret);
|
||||||
const isSecretEmpty = secret?.value === "";
|
const isSecretEmpty = secret?.value === "";
|
||||||
return (
|
return (
|
||||||
@@ -69,16 +74,29 @@ export const SecretOverviewTableRow = ({
|
|||||||
className={twMerge(
|
className={twMerge(
|
||||||
"py-0 px-0 group-hover:bg-mineshaft-700",
|
"py-0 px-0 group-hover:bg-mineshaft-700",
|
||||||
isFormExpanded && "border-t-2 border-mineshaft-500",
|
isFormExpanded && "border-t-2 border-mineshaft-500",
|
||||||
isSecretPresent && !isSecretEmpty ? "text-green-600" : "",
|
(isSecretPresent && !isSecretEmpty) || isSecretImported ? "text-green-600" : "",
|
||||||
isSecretPresent && isSecretEmpty ? "text-yellow" : "",
|
isSecretPresent && isSecretEmpty && !isSecretImported ? "text-yellow" : "",
|
||||||
!isSecretPresent && !isSecretEmpty ? "text-red-600" : ""
|
!isSecretPresent && !isSecretEmpty && !isSecretImported ? "text-red-600" : ""
|
||||||
)}
|
)}
|
||||||
>
|
>
|
||||||
<div className="h-full w-full border-r border-mineshaft-600 py-[0.85rem] px-5">
|
<div className="h-full w-full border-r border-mineshaft-600 py-[0.85rem] px-5">
|
||||||
<div className="flex justify-center">
|
<div className="flex justify-center">
|
||||||
{!isSecretEmpty && (
|
{!isSecretEmpty && (
|
||||||
<Tooltip content={isSecretPresent ? "Present secret" : "Missing secret"}>
|
<Tooltip
|
||||||
<FontAwesomeIcon icon={isSecretPresent ? faCheck : faXmark} />
|
center
|
||||||
|
content={
|
||||||
|
// eslint-disable-next-line no-nested-ternary
|
||||||
|
isSecretPresent
|
||||||
|
? "Present secret"
|
||||||
|
: isSecretImported
|
||||||
|
? "Secret is imported from another environment"
|
||||||
|
: "Missing secret"
|
||||||
|
}
|
||||||
|
>
|
||||||
|
<FontAwesomeIcon
|
||||||
|
// eslint-disable-next-line no-nested-ternary
|
||||||
|
icon={isSecretPresent ? faCheck : isSecretImported ? faFileImport : faXmark}
|
||||||
|
/>
|
||||||
</Tooltip>
|
</Tooltip>
|
||||||
)}
|
)}
|
||||||
{isSecretEmpty && (
|
{isSecretEmpty && (
|
||||||
|
|||||||
Reference in New Issue
Block a user