-
-
Notifications
You must be signed in to change notification settings - Fork 162
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(platform): implement secrets version history and rollback functionality #794
base: develop
Are you sure you want to change the base?
feat(platform): implement secrets version history and rollback functionality #794
Conversation
…ionality Changes made: - Added rollbackVariableOpenAtom to manage rollback dialog state - Enhanced VariableCard component with version history context menu item - Created RollbackVariableSheet component for displaying version history - Added proper focus and accessibility management for dialogs - Implemented UI for version timeline with rollback actions - Added proper types for API responses and client data Key files modified: 1. /store/index.ts - Added rollbackVariableOpenAtom for managing rollback dialog state 2. /components/dashboard/variable/variableCard/index.tsx - Added version history context menu item - Added rollback state management - Implemented handleVersionHistoryClick 3. /components/dashboard/variable/rollbackVariableSheet/index.tsx - Created new component for version history UI - Implemented version timeline with rollback buttons - Added proper focus management and accessibility - Added version comparison and rollback confirmation 4. /@variable/page.tsx - Added RollbackVariableSheet integration - Improved dialog management with data-inert attribute - Enhanced type safety for API responses Testing: - Right-click on variable opens context menu - "Show Version History" opens timeline view - Rollback button triggers confirmation dialog - Focus management works correctly - Accessibility standards maintained
- Fixed secret value decryption in RollbackSecretSheet - Updated version number format to use "v" prefix - Removed unused utility functions and fix TypeScript errors - Added isDecrypted prop to handle encrypted/decrypted values - Improved type safety in SecretCard component
PR Reviewer Guide 🔍Here are some key observations to aid the review process:
|
PR Code Suggestions ✨Explore these optional code suggestions:
|
</div> | ||
) | ||
} | ||
.finally(() => { if (!isLoading) { setIsLoading(false) } }) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Revert back this line, i dont think the change is relevant.
|
||
<div className="flex h-[5rem] w-[30.25rem] flex-col items-center justify-center gap-4"> | ||
<p className="h-[2.5rem] w-[30.25rem] text-center text-[32px] font-[400]"> | ||
Declare your first secret | ||
Secrete your firstSecret |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Revert this change
</p> | ||
<p className="h-[1.5rem] w-[30.25rem] text-center text-[16px] font-[500]"> | ||
Declare and store a secret against different environments | ||
Declare and store a Secret against different environments |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
revert this aswell
</p> | ||
</div> | ||
|
||
<Button | ||
className="h-[2.25rem] rounded-md bg-white text-black hover:bg-gray-300" | ||
onClick={() => setIsCreateSecretOpen(true)} | ||
> | ||
Create secret | ||
CreateSecret |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
And this
{isDeleteSecretOpen && selectedSecret ? ( | ||
<ConfirmDeleteSecret /> | ||
) : null} | ||
<Accordion className="flex h-fit w-full flex-col gap-4" collapsible type="single"> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Any special reason for removing the scroll area?
} | ||
}, [selectedSecretData, isRollbackSecretOpen]) | ||
|
||
const handleRollbackClick = useCallback((environmentSlug: string, version: number) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
instead of passing parameters, callback should get them from state variables and update the deps array
revisions: Revision[] | ||
} | ||
|
||
interface RollbackDetails { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This can be inlined to the state
interface SecretCardProps { | ||
secretData: Secret | ||
secretData: Secret | undefined |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Secret data can never be undefined by design
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
text changes should be similar to the ones i mentioned in variables dialog
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
type changes and logic changes should be similar to the ones mentioned in secrets
Also, can you post a few other screenshots?
|
alright, thanks for the reiview, ill make those changes |
@anaypurohit0907, please resolve all open reviews! |
@anaypurohit0907, please resolve all open reviews; otherwise this PR will be closed after Sun Mar 02 2025 14:05:52 GMT+0000 (Coordinated Universal Time)! |
hey @anaypurohit0907, any updates? |
…lated files except rollbacksecretsheet
yes i have made all the changes you mentioned except to |
no worries man! i'm converting this to a draft. please open it up again once its good for review :) appreciate your efforts |
User description
Description
Added complete version history tracking and rollback capabilities for secrets. Users can now view version history of secrets across environments and roll back to previous versions when needed.
Fixes #700
Fixes #563
Dependencies
No new dependencies were added.
Future Improvements
As discussed on call with @rajdip-b we wiil be integrating the rollback api.
Mentions
Team name for fossHack20225: BunLock
Team Members:
@anaypurohit0907
@Dhanushranga1
@hanish-rishen
Thanks @rajdip-b for guiding us and answering all of our questions.
Screenshots of relevant screens
Tests
Developer's checklist
If changes are made in the code:
Documentation Update
PR Type
Enhancement, Tests
Description
Added rollback functionality for secrets and variables.
RollbackSecretSheet
andRollbackVariableSheet
components for version history and rollback actions.rollbackSecretOpenAtom
androllbackVariableOpenAtom
for state management.Enhanced
SecretCard
andVariableCard
components.Introduced
ConfirmRollbackDialog
for rollback confirmation.Updated project state management in
store/index.ts
.Changes walkthrough 📝
9 files
Integrated rollback functionality for secrets
Integrated rollback functionality for variables
Added rollback confirmation dialog for secrets
Created rollback sheet for secrets with version history
Enhanced secret card with version history option
Added rollback confirmation dialog for variables
Created rollback sheet for variables with version history
Enhanced variable card with version history option
Added rollback state management atoms