-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #273 from pointnetwork/PD-211
Add a restart button for node and show an alert if node is not running
- Loading branch information
Showing
2 changed files
with
41 additions
and
2 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
import { useState, ReactEventHandler, useEffect } from 'react' | ||
import Alert from '@mui/material/Alert' | ||
import Typography from '@mui/material/Typography' | ||
|
||
const NodeRestartAlert = ({ isNodeRunning }: { isNodeRunning: boolean }) => { | ||
const [showAlert, setShowAlert] = useState<boolean>(false) | ||
|
||
useEffect(() => { | ||
setShowAlert(!isNodeRunning) | ||
}, [isNodeRunning]) | ||
|
||
const handleCloseAlert: ReactEventHandler = () => setShowAlert(false) | ||
|
||
return showAlert ? ( | ||
<Alert | ||
sx={{ | ||
position: 'absolute', | ||
right: 12, | ||
top: 36, | ||
zIndex: 999999, | ||
maxWidth: '360px', | ||
}} | ||
severity="error" | ||
onClose={handleCloseAlert} | ||
> | ||
<Typography fontWeight="bold">Point Node is not running</Typography> | ||
<Typography> | ||
Try restarting the Point Node by clicking the 'Restart Node' button | ||
</Typography> | ||
</Alert> | ||
) : null | ||
} | ||
|
||
export default NodeRestartAlert |