-
Notifications
You must be signed in to change notification settings - Fork 798
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 investigation graph after expanding a node (#3167)
- Loading branch information
1 parent
2d71d35
commit 8c4a973
Showing
18 changed files
with
332 additions
and
22 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
53 changes: 53 additions & 0 deletions
53
...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,53 @@ | ||
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 { getPreExpansionStateList } from '../utils/investigationStorage'; | ||
import { useFormatter } from '../../../../../components/i18n'; | ||
|
||
type InvestigationRollBackExpandDialogProps = { | ||
closeDialog: () => void; | ||
handleRollBackToPreExpansionState: () => void; | ||
isOpen: boolean; | ||
}; | ||
|
||
const InvestigationRollBackExpandDialog = ({ closeDialog, handleRollBackToPreExpansionState, isOpen }: InvestigationRollBackExpandDialogProps) => { | ||
const { t_i18n, fldt } = useFormatter(); | ||
|
||
const handleSubmit = () => { | ||
handleRollBackToPreExpansionState(); | ||
closeDialog(); | ||
}; | ||
|
||
const getLastRollBackExpandDate = () => { | ||
const storedPreExpansion = getPreExpansionStateList(); | ||
if (storedPreExpansion) { | ||
return fldt(JSON.parse(storedPreExpansion)[0].dateTime); | ||
} | ||
return null; | ||
}; | ||
|
||
return ( | ||
<Dialog | ||
PaperProps={{ elevation: 1 }} | ||
open={isOpen} | ||
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 add or remove actions done on the graph 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; |
Oops, something went wrong.