add reset database button
This commit is contained in:
parent
f43af563e5
commit
62fd24fd7a
|
@ -1,19 +1,26 @@
|
|||
import React, { Fragment } from 'react'
|
||||
import Button from '@material-ui/core/Button'
|
||||
import { Button, Divider } from '@material-ui/core'
|
||||
import { FundingContext } from '../context'
|
||||
import SetMockedTime from './SetMockedTime'
|
||||
import database from '../db'
|
||||
|
||||
|
||||
async function resetDb(openSnackBar) {
|
||||
await database.unsafeResetDatabase()
|
||||
openSnackBar('success', 'Database has been reset. Refresh the page to populate it')
|
||||
}
|
||||
|
||||
const ContractAdmin = () => (
|
||||
<FundingContext.Consumer>
|
||||
{({ needsInit, initVaultAndLP, standardTokenApproval }) =>
|
||||
{({ needsInit, initVaultAndLP, standardTokenApproval, openSnackBar }) =>
|
||||
<Fragment>
|
||||
<Button color="secondary" variant="contained" onClick={() => resetDb(openSnackBar)}>RESET DATABASE</Button>
|
||||
<Divider />
|
||||
{needsInit && <Button variant="outlined" color="secondary" onClick={initVaultAndLP}>
|
||||
Initialize Contracts
|
||||
</Button>}
|
||||
<Button variant="outlined" color="primary" onClick={standardTokenApproval}>
|
||||
{needsInit && <Button variant="outlined" color="primary" onClick={standardTokenApproval}>
|
||||
GIVE VAULT TOKEN APPROVAL
|
||||
</Button>
|
||||
<SetMockedTime />
|
||||
</Button>}
|
||||
</Fragment>
|
||||
}
|
||||
</FundingContext.Consumer>
|
||||
|
|
|
@ -183,7 +183,7 @@ class PersistentDrawerLeft extends React.Component {
|
|||
<Link to="/admin/" className={classes.link}>
|
||||
<ListItem button>
|
||||
<ListItemIcon><InboxIcon /></ListItemIcon>
|
||||
<ListItemText primary="Contract Admin" />
|
||||
<ListItemText primary="Admin" />
|
||||
</ListItem>
|
||||
</Link>
|
||||
</List>
|
||||
|
|
Loading…
Reference in New Issue