improvement(frontend): enhance secret diff view and commit handling#5364
improvement(frontend): enhance secret diff view and commit handling#5364victorvhs017 merged 15 commits intomainfrom
Conversation
- Introduced `DiffContainer` for styled diff display with scroll-to-first-change functionality. - Implemented `FieldDiffRenderers` for inline text, tags, and metadata diff rendering. - Added `MultiLineDiff` and `SingleLineDiff` components for handling multi-line and single-line differences. - Created `SecretDiffView` to encapsulate the diff view logic for secret versions. - Enhanced utility functions for computing line and word diffs.
- Added logic to handle folder-only changes in the commit process, allowing immediate saves without approval. - Updated `SecretDiffView` to include a new `CommentRenderer` for improved comment diff display. - Enhanced `SingleLineDiff` and `MultiLineDiff` components for better text highlighting and rendering. - Refactored tag handling in `SecretDetailSidebar` to ensure color attributes are preserved. - Improved styling for diff components to enhance user experience.
…ntification - Modified key generation logic in the `InlineTextDiff` component to use the index of changes instead of the change value, ensuring unique keys for each change item.
✅ Snyk checks have passed. No issues have been found so far.
💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse. |
Greptile OverviewGreptile SummaryThis PR introduces a well-structured refactoring of secret diff visualization with new reusable components. The changes add Key improvements:
The implementation uses the Confidence Score: 4/5
Important Files Changed
|
…RequestChangeItem - Updated the tag mapping logic in `SecretApprovalRequestChangeItem` to provide a default empty string for color attributes when they are undefined, ensuring consistent rendering of tags.
…ffView - Refactored the metadata assignment in `SecretVersionDiffView` to use a unified variable, improving code clarity and ensuring consistent handling of secret metadata.
- Updated the logic for assigning the secret value in the `CommitForm` component to streamline the retrieval process, ensuring that the original value is prioritized while maintaining compatibility with existing values.
scott-ray-wilson
left a comment
There was a problem hiding this comment.
This is great! some thoughts / comments
…diff display - Introduced a new `KeyRenderer` component to handle the rendering of secret keys in the `SecretDiffView`, enhancing the clarity of changes by distinguishing between added and removed keys. - Replaced the previous inline text diff logic with the new component for better code organization and maintainability.
- Updated `DiffContainer` to allow an optional `variant` prop for better background color handling. - Introduced `FolderDiffView` component to display differences in folder versions, including name and description changes. - Refactored `FieldDiffRenderers` to include new `SingleLineTextDiffRenderer` and `MultiLineTextDiffRenderer` for improved text diff rendering. - Enhanced `SecretDiffView` to utilize new renderers and support encrypted metadata display. - Updated `CommitForm` and `SecretListView` to accommodate new properties in secret changes, including tags and comments.
- Removed scroll-to-first-change behavior from `DiffContainer` for a cleaner implementation. - Updated `SecretValueRenderer` to handle visibility toggling and scrolling to the first change when revealing multi-line content. - Improved rendering of secret values and comments for better readability and consistency.
…questChangeItem - Updated the type definition for skipMultilineEncoding to allow null values. - Ensured that skipMultilineEncoding defaults to undefined when both change and secret values are not provided, improving data handling consistency.
…Item - Updated form handling to fetch and incorporate secret values when saving, ensuring the commit diff modal displays accurate data. - Added logic to reset form fields when switching between secrets, improving user experience. - Refactored save operations in both SecretDetailSidebar and SecretItem components to manage fetched values more effectively.
…iffView - Replaced setTimeout with requestAnimationFrame for smoother scrolling to the first change in SecretValueRenderer. - Updated metadata handling in SecretDiffView to ensure only new version metadata is passed, enhancing clarity and performance.
…iew and CommitForm - Added support for revealing old and new secret values with loading states in SecretDiffView and SecretVersionDiffView. - Updated CommitForm to manage loading states when fetching secret values, ensuring accurate display in the commit diff modal. - Refactored related components to improve handling of secret value visibility and loading indicators.
…deletions - Improved logic in SecretMainPage.store to handle updates and deletions of secrets, ensuring correct value assignment based on action type. - Updated CommitForm and SecretListView to manage secret value visibility and loading states more effectively, allowing for better user experience during secret operations. - Refactored fetching logic in ResourceChange to accommodate both update and delete actions, ensuring accurate display of secret values in the UI.
scott-ray-wilson
left a comment
There was a problem hiding this comment.
LGTM, nice work, looks great!
Context
This PR introduces reusable diff components for secret version comparison and improves the commit handling experience. The changes:
SecretDiffViewcomponent with dedicated renderers for single-line, multi-line, tags, and metadata diffsSecretVersionDiffViewto use the newSecretDiffViewfor secrets while maintaining JSON diff for foldersScreenshots
Steps to verify the change
Type
Checklist
type(scope): short description(scope is optional, e.g.,fix: prevent crash on syncorfix(api): handle null response).