add reset database button

This commit is contained in:
Barry Gitarts 2019-04-16 11:29:07 -04:00
parent f43af563e5
commit 62fd24fd7a
2 changed files with 21 additions and 14 deletions

View File

@ -1,21 +1,28 @@
import React, { Fragment } from 'react' import React, { Fragment } from 'react'
import Button from '@material-ui/core/Button' import { Button, Divider } from '@material-ui/core'
import { FundingContext } from '../context' 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 = () => ( const ContractAdmin = () => (
<FundingContext.Consumer> <FundingContext.Consumer>
{({ needsInit, initVaultAndLP, standardTokenApproval }) => {({ needsInit, initVaultAndLP, standardTokenApproval, openSnackBar }) =>
<Fragment> <Fragment>
{needsInit && <Button variant="outlined" color="secondary" onClick={initVaultAndLP}> <Button color="secondary" variant="contained" onClick={() => resetDb(openSnackBar)}>RESET DATABASE</Button>
Initialize Contracts <Divider />
</Button>} {needsInit && <Button variant="outlined" color="secondary" onClick={initVaultAndLP}>
<Button variant="outlined" color="primary" onClick={standardTokenApproval}> Initialize Contracts
GIVE VAULT TOKEN APPROVAL </Button>}
</Button> {needsInit && <Button variant="outlined" color="primary" onClick={standardTokenApproval}>
<SetMockedTime /> GIVE VAULT TOKEN APPROVAL
</Fragment> </Button>}
} </Fragment>
}
</FundingContext.Consumer> </FundingContext.Consumer>
) )

View File

@ -183,7 +183,7 @@ class PersistentDrawerLeft extends React.Component {
<Link to="/admin/" className={classes.link}> <Link to="/admin/" className={classes.link}>
<ListItem button> <ListItem button>
<ListItemIcon><InboxIcon /></ListItemIcon> <ListItemIcon><InboxIcon /></ListItemIcon>
<ListItemText primary="Contract Admin" /> <ListItemText primary="Admin" />
</ListItem> </ListItem>
</Link> </Link>
</List> </List>