+
- Secret approval merged
+ Change request merged
- Merged by {statusChangeByEmail}
+ Merged by {statusChangeByEmail}.
diff --git a/frontend/src/pages/secret-manager/SecretApprovalsPage/components/SecretApprovalRequest/components/SecretApprovalRequestChangeItem.tsx b/frontend/src/pages/secret-manager/SecretApprovalsPage/components/SecretApprovalRequest/components/SecretApprovalRequestChangeItem.tsx
index 212f929f7..35f6474d5 100644
--- a/frontend/src/pages/secret-manager/SecretApprovalsPage/components/SecretApprovalRequest/components/SecretApprovalRequestChangeItem.tsx
+++ b/frontend/src/pages/secret-manager/SecretApprovalsPage/components/SecretApprovalRequest/components/SecretApprovalRequestChangeItem.tsx
@@ -1,19 +1,12 @@
-import { faExclamationTriangle, faInfo, faKey } from "@fortawesome/free-solid-svg-icons";
+import { faCircleXmark, faExclamationTriangle, faEye, faEyeSlash, faInfo, faKey } from "@fortawesome/free-solid-svg-icons";
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
import {
- SecretInput,
- Table,
- TableContainer,
Tag,
- TBody,
- Td,
- Th,
- THead,
- Tooltip,
- Tr
+ Tooltip
} from "@app/components/v2";
import { CommitType, SecretV3Raw, TSecretApprovalSecChange, WsTag } from "@app/hooks/api/types";
+import { useState } from "react";
export type Props = {
op: CommitType;
@@ -29,19 +22,19 @@ export type Props = {
const generateItemTitle = (op: CommitType) => {
let text = { label: "", color: "" };
- if (op === CommitType.CREATE) text = { label: "create", color: "#16a34a" };
- else if (op === CommitType.UPDATE) text = { label: "change", color: "#ea580c" };
- else text = { label: "deletion", color: "#b91c1c" };
+ if (op === CommitType.CREATE) text = { label: "create", color: "#60DD00" };
+ else if (op === CommitType.UPDATE) text = { label: "change", color: "#F8EB30" };
+ else text = { label: "deletion", color: "#F83030" };
return (
-
+
Request for secret {text.label}
-
+
);
};
const generateConflictText = (op: CommitType) => {
- if (op === CommitType.CREATE) return Secret already exist
;
+ if (op === CommitType.CREATE) return Secret already exists
;
if (op === CommitType.UPDATE) return Secret not found
;
return null;
};
@@ -59,10 +52,12 @@ export const SecretApprovalRequestChangeItem = ({
const itemConflict =
hasMerged && conflicts.find((el) => el.op === op && el.secretId === newVersion?.id);
const hasConflict = Boolean(itemConflict);
+ const [isOldSecretValueVisible, setIsOldSecretValueVisible] = useState(false);
+ const [isNewSecretValueVisible, setIsNewSecretValueVisible] = useState(false);
return (
-
-
+
+
{generateItemTitle(op)}
{!hasMerged && isStale && (
@@ -79,35 +74,43 @@ export const SecretApprovalRequestChangeItem = ({
)}
-
-
-
-
- {op === CommitType.UPDATE && | }
- Secret |
- Value |
- Comment |
- Tags |
- Metadata |
-
-
- {op === CommitType.UPDATE ? (
-
-
- | OLD |
- {secretVersion?.secretKey} |
-
- {newVersion?.isRotatedSecret ? (
-
- Rotated Secret value will not be affected
-
- ) : (
-
- )}
- |
- {secretVersion?.secretComment} |
-
- {secretVersion?.tags?.map(({ slug, id: tagId, color }) => (
+
+
+ {op === CommitType.UPDATE || op === CommitType.DELETE ? (
+
+
+ Legacy Secret
+
+
+ Deprecated
+
+
+
+ Key
+ {secretVersion?.secretKey}
+
+
+ Value
+ {newVersion?.isRotatedSecret ? (
+
+ Rotated Secret value will not be affected
+
+ ) : (
+ setIsOldSecretValueVisible(!isOldSecretValueVisible)} className="pl-2 border border-mineshaft-500 bg-mineshaft-900 rounded-md flex flex-row justify-between items-center">
+ {isOldSecretValueVisible ? (secretVersion?.secretValue || "EMPTY") : (secretVersion?.secretValue ? secretVersion?.secretValue?.split('').map((_, index) => "•") : "EMPTY")}
+ {secretVersion?.secretValue &&
}
+
+ )}
+
+
+
+ Comment
+ {secretVersion?.secretComment || -}
+
+
+ Tags
+
+ {secretVersion?.tags?.length ?? 0 ? secretVersion?.tags?.map(({ slug, id: tagId, color }) => (
{slug}
- ))}
- |
-
+ )) : -}
+
+
+
+ Metadata
+
{secretVersion?.secretMetadata?.length ? (
{secretVersion.secretMetadata?.map((el) => (
@@ -146,23 +152,45 @@ export const SecretApprovalRequestChangeItem = ({
) : (
-
)}
- |
-
-
- | NEW |
- {newVersion?.secretKey} |
-
- {newVersion?.isRotatedSecret ? (
-
- Rotated Secret value will not be affected
-
- ) : (
-
- )}
- |
- {newVersion?.secretComment} |
-
- {newVersion?.tags?.map(({ slug, id: tagId, color }) => (
+
+
+ )
+ : Secret not existent in the previous version. }
+ {op === CommitType.UPDATE || op === CommitType.CREATE ? (
+
+
+ New Secret
+
+
+ Current
+
+
+
+ Key
+ {newVersion?.secretKey}
+
+
+ Value
+ {newVersion?.isRotatedSecret ? (
+
+ Rotated Secret value will not be affected
+
+ ) : (
+ setIsNewSecretValueVisible(!isNewSecretValueVisible)} className="pl-2 border border-mineshaft-500 bg-mineshaft-900 rounded-md flex flex-row justify-between items-center">
+ {isNewSecretValueVisible ? (newVersion?.secretValue || "EMPTY") : (newVersion?.secretValue ? newVersion?.secretValue?.split('').map((_, index) => "•") : "EMPTY")}
+ {newVersion?.secretValue &&
}
+
+ )}
+
+
+
+ Comment
+ {newVersion?.secretComment || -}
+
+
+ Tags
+
+ {newVersion?.tags?.length ?? 0 ? newVersion?.tags?.map(({ slug, id: tagId, color }) => (
{slug}
- ))}
- |
-
- {newVersion?.secretMetadata?.length ? (
-
- {newVersion.secretMetadata?.map((el) => (
-
-
-
- {el.key}
-
-
-
- {el.value}
-
-
-
- ))}
-
- ) : (
- -
- )}
- |
-
-
- ) : (
-
-
- |
- {op === CommitType.CREATE ? newVersion?.secretKey : secretVersion?.secretKey}
- |
-
-
- |
-
- {op === CommitType.CREATE
- ? newVersion?.secretComment
- : secretVersion?.secretComment}
- |
-
- {(op === CommitType.CREATE ? newVersion?.tags : secretVersion?.tags)?.map(
- ({ slug, id: tagId, color }) => (
-
-
- {slug}
-
- )
- )}
- |
-
- {newVersion?.secretMetadata?.length ? (
-
- {newVersion.secretMetadata?.map((el) => (
-
-
-
- {el.key}
-
-
-
- {el.value}
-
-
-
- ))}
-
- ) : (
- -
- )}
- |
-
-
- )}
-
-
+ )) :
-}
+
+
+
+
Metadata
+ {newVersion?.secretMetadata?.length ? (
+
+ {newVersion.secretMetadata?.map((el) => (
+
+
+
+ {el.key}
+
+
+
+ {el.value}
+
+
+
+ ))}
+
+ ) : (
+
-
+ )}
+
+
)
+ : Secret not existent in the new version.
}
+