From d369d17a0656d074c224f7f5c4c782d446a2412f Mon Sep 17 00:00:00 2001 From: Rohan Date: Tue, 10 Dec 2024 14:16:22 +0530 Subject: [PATCH] feat: close history dialog on restore --- .../environments/secrets/HistoryDialog.tsx | 1 + .../environments/secrets/SecretPropertyDiffs.tsx | 12 +++++++++--- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/frontend/components/environments/secrets/HistoryDialog.tsx b/frontend/components/environments/secrets/HistoryDialog.tsx index 7e071e85..27905c89 100644 --- a/frontend/components/environments/secrets/HistoryDialog.tsx +++ b/frontend/components/environments/secrets/HistoryDialog.tsx @@ -235,6 +235,7 @@ export const HistoryDialog = ({ historyItem={historyItem!} index={index} handlePropertyChange={handlePropertyChange} + onRestore={closeModal} /> )} diff --git a/frontend/components/environments/secrets/SecretPropertyDiffs.tsx b/frontend/components/environments/secrets/SecretPropertyDiffs.tsx index 4ee9b2ff..39500fd5 100644 --- a/frontend/components/environments/secrets/SecretPropertyDiffs.tsx +++ b/frontend/components/environments/secrets/SecretPropertyDiffs.tsx @@ -4,14 +4,19 @@ import { FaRedoAlt, FaUndoAlt } from 'react-icons/fa' import { Button } from '../../common/Button' import { Tag } from '../Tag' -export const SecretPropertyDiffs = (props: { +export const SecretPropertyDiffs = ({ + secret, + historyItem, + index, + handlePropertyChange, + onRestore, +}: { secret: SecretType historyItem: SecretEventType index: number handlePropertyChange: Function + onRestore: Function }) => { - const { secret, historyItem, index, handlePropertyChange } = props - const previousItem = secret.history![index - 1]! const getAddedTags = () => { @@ -30,6 +35,7 @@ export const SecretPropertyDiffs = (props: { const handleRestoreValue = (value: string) => { handlePropertyChange(secret.id, 'value', value) + onRestore() } return (