diff --git a/frontend/src/pages/secret-manager/CommitDetailsPage/components/SecretVersionDiffView/SecretVersionDiffView.tsx b/frontend/src/pages/secret-manager/CommitDetailsPage/components/SecretVersionDiffView/SecretVersionDiffView.tsx index 7744d3626..bc45cf5b6 100644 --- a/frontend/src/pages/secret-manager/CommitDetailsPage/components/SecretVersionDiffView/SecretVersionDiffView.tsx +++ b/frontend/src/pages/secret-manager/CommitDetailsPage/components/SecretVersionDiffView/SecretVersionDiffView.tsx @@ -475,7 +475,7 @@ const formatDeletedJson = (json: JsonValue): JSX.Element => { const cleanVersionForComparison = (version: Version): JsonValue => { const { id, version: versionNumber, ...cleanVersion } = version; - return cleanVersion; + return Object.fromEntries(Object.entries(cleanVersion).filter((entry) => Boolean(entry[1]))); }; export const SecretVersionDiffView = ({ @@ -486,6 +486,7 @@ export const SecretVersionDiffView = ({ customHeader, excludedFieldsHighlight = ["metadata", "tags"] }: SecretVersionDiffViewProps) => { + console.log("item", item); const oldContainerRef = useRef(null); const newContainerRef = useRef(null); const [internalCollapsed, setInternalCollapsed] = useState(isCollapsed); diff --git a/frontend/src/pages/secret-manager/SecretDashboardPage/components/CommitForm/CommitForm.tsx b/frontend/src/pages/secret-manager/SecretDashboardPage/components/CommitForm/CommitForm.tsx index f3fef4fd9..0943f15fd 100644 --- a/frontend/src/pages/secret-manager/SecretDashboardPage/components/CommitForm/CommitForm.tsx +++ b/frontend/src/pages/secret-manager/SecretDashboardPage/components/CommitForm/CommitForm.tsx @@ -1,20 +1,12 @@ /* eslint-disable jsx-a11y/label-has-associated-control */ import React, { useState } from "react"; -import { - faChevronDown, - faChevronRight, - faCodeCommit, - faEye, - faFolder, - faKey, - faTrash -} from "@fortawesome/free-solid-svg-icons"; +import { faCodeCommit, faEye, faFolder, faKey, faTrash } from "@fortawesome/free-solid-svg-icons"; import { FontAwesomeIcon } from "@fortawesome/react-fontawesome"; -import { twMerge } from "tailwind-merge"; -import { Badge, Button, IconButton, Input, Modal, ModalContent, Tooltip } from "@app/components/v2"; +import { Badge, Button, Input, Modal, ModalContent } from "@app/components/v2"; import { useToggle } from "@app/hooks"; import { PendingAction } from "@app/hooks/api/secretFolders/types"; +import { SecretVersionDiffView } from "@app/pages/secret-manager/CommitDetailsPage/components/SecretVersionDiffView"; import { PendingChange, @@ -178,6 +170,8 @@ const ChangeTable: React.FC = ({ } if (change.type === PendingAction.Update) { + const { existingSecret } = change; + const hasKeyChange = change.newSecretName && change.secretKey !== change.newSecretName; const hasValueChange = change.secretValue !== change.originalValue; const hasCommentChange = change.secretComment !== change.originalComment; @@ -199,85 +193,58 @@ const ChangeTable: React.FC = ({ if (!hasChanges) return null; return ( - - - {hasKeyChange && ( - {change.existingSecret.key}} - newValue={{change.newSecretName}} - /> - )} - {hasValueChange && ( - - {change.existingSecret.value || ( - (empty) - )} - - } - newValue={ -
- {change.secretValue || ( - (empty) - )} -
- } - /> - )} - {hasCommentChange && ( - (empty) - ) - } - newValue={ - change.secretComment || (empty) - } - /> - )} - {hasMultilineChange && ( - - )} - {hasTagsChange && ( - } - newValue={} - /> - )} - {hasMetadataChange && ( - } - newValue={} - /> - )} -
-
+ ); } if (change.type === PendingAction.Delete) { + const { secretKey, secretValue } = change; return ( - - - - - - - -
Key: - {change.secretKey} -
+ ); } @@ -382,71 +349,30 @@ const ChangeTable: React.FC = ({ }); }; - return ( -
-
setIsOpen.toggle()} - onKeyDown={(e) => { - if (e.key === "Enter") { - setIsOpen.toggle(); - } - }} - > - + return change.resourceType === "secret" ? renderSecretChanges() : renderFolderChanges(); -
- {getChangeName()} - {getChangeBadge(change.type)} -
- - handleDeletePending(change.resourceType, change.id)} - > - - - -
- - {isOpen ? ( -
- {change.resourceType === "secret" ? renderSecretChanges() : renderFolderChanges()} -
- ) : null} -
- ); - - return ( -
-
-
- {getChangeName()} - {getChangeBadge(change.type)} -
- - handleDeletePending(change.resourceType, change.id)} - > - - - -
- {change.resourceType === "secret" ? renderSecretChanges() : renderFolderChanges()} -
- ); + // return ( + //
+ //
+ //
+ // {getChangeName()} + // {getChangeBadge(change.type)} + //
+ // + // handleDeletePending(change.resourceType, change.id)} + // > + // + // + // + //
+ // {change.resourceType === "secret" ? renderSecretChanges() : renderFolderChanges()} + //
+ // ); }; export const CommitForm: React.FC = ({