-
Notifications
You must be signed in to change notification settings - Fork 933
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[frontend] roll back to pre expansion state added with session storag…
…e history (#3167)
- Loading branch information
1 parent
372a1df
commit afe5ee2
Showing
15 changed files
with
248 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
52 changes: 52 additions & 0 deletions
52
...private/components/workspaces/investigations/Dialog/InvestigationRollBackExpandDialog.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
import React from 'react'; | ||
import Dialog from '@mui/material/Dialog'; | ||
import DialogTitle from '@mui/material/DialogTitle'; | ||
import DialogContent from '@mui/material/DialogContent'; | ||
import DialogActions from '@mui/material/DialogActions'; | ||
import Button from '@mui/material/Button'; | ||
import { useFormatter } from 'src/components/i18n'; | ||
|
||
type InvestigationRollBackExpandDialogProps = { | ||
closeDialog: () => void; | ||
handleRollBackToPreExpansionState: () => void; | ||
isRollBackPreExpandStateDialogOpen: boolean; | ||
}; | ||
|
||
const InvestigationRollBackExpandDialog = ({ closeDialog, handleRollBackToPreExpansionState, isRollBackPreExpandStateDialogOpen }: InvestigationRollBackExpandDialogProps) => { | ||
const { t_i18n, fldt } = useFormatter(); | ||
|
||
const handleSubmit = () => { | ||
handleRollBackToPreExpansionState(); | ||
closeDialog(); | ||
}; | ||
|
||
const getLastRollBackExpandDate = () => { | ||
const storedPreExpansion = sessionStorage.getItem('preExpansionStateList'); | ||
if (storedPreExpansion) { | ||
return fldt(JSON.parse(storedPreExpansion)[0].dateTime); | ||
} | ||
return null; | ||
}; | ||
|
||
return ( | ||
<Dialog | ||
PaperProps={{ elevation: 1 }} | ||
open={isRollBackPreExpandStateDialogOpen} | ||
onClose={closeDialog} | ||
fullWidth={true} | ||
maxWidth="sm" | ||
> | ||
<DialogTitle>{t_i18n('Revert to Pre-Expansion State')}</DialogTitle> | ||
<DialogContent> | ||
<p>{t_i18n('Last expansion')}: {getLastRollBackExpandDate()}</p> | ||
<p>{t_i18n('All actions after the last expansion will be lost.')}</p> | ||
</DialogContent> | ||
<DialogActions> | ||
<Button onClick={closeDialog}>{t_i18n('Cancel')}</Button> | ||
<Button onClick={handleSubmit} color="secondary">{t_i18n('Validate')}</Button> | ||
</DialogActions> | ||
</Dialog> | ||
); | ||
}; | ||
|
||
export default InvestigationRollBackExpandDialog; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.