Fix minor bugs on history

This commit is contained in:
Paulo Gustavo Veiga 2021-02-05 13:28:32 -08:00
parent 85d44786c7
commit 2a7387cb6c
3 changed files with 76 additions and 15 deletions

View File

@ -110,6 +110,9 @@
"forgot.desc": { "forgot.desc": {
"defaultMessage": "We will send you an email to reset your password" "defaultMessage": "We will send you an email to reset your password"
}, },
"forgot.email": {
"defaultMessage": "Email"
},
"forgot.register": { "forgot.register": {
"defaultMessage": "Send recovery link" "defaultMessage": "Send recovery link"
}, },
@ -128,6 +131,9 @@
"header.haveaccount": { "header.haveaccount": {
"defaultMessage": "Already have an account?" "defaultMessage": "Already have an account?"
}, },
"history.no-changes": {
"defaultMessage": "There is no changes available"
},
"login.desc": { "login.desc": {
"defaultMessage": "Log into your account" "defaultMessage": "Log into your account"
}, },
@ -198,6 +204,18 @@
"registration.desc": { "registration.desc": {
"defaultMessage": "Signing up is free and just take a moment" "defaultMessage": "Signing up is free and just take a moment"
}, },
"registration.email": {
"defaultMessage": "Email"
},
"registration.firstname": {
"defaultMessage": "First Name"
},
"registration.lastname": {
"defaultMessage": "Last Name"
},
"registration.password": {
"defaultMessage": "Password"
},
"registration.register": { "registration.register": {
"defaultMessage": "Register" "defaultMessage": "Register"
}, },

View File

@ -221,6 +221,12 @@
"value": "We will send you an email to reset your password" "value": "We will send you an email to reset your password"
} }
], ],
"forgot.email": [
{
"type": 0,
"value": "Email"
}
],
"forgot.register": [ "forgot.register": [
{ {
"type": 0, "type": 0,
@ -257,6 +263,12 @@
"value": "Already have an account?" "value": "Already have an account?"
} }
], ],
"history.no-changes": [
{
"type": 0,
"value": "There is no changes available"
}
],
"login.desc": [ "login.desc": [
{ {
"type": 0, "type": 0,
@ -395,6 +407,30 @@
"value": "Signing up is free and just take a moment" "value": "Signing up is free and just take a moment"
} }
], ],
"registration.email": [
{
"type": 0,
"value": "Email"
}
],
"registration.firstname": [
{
"type": 0,
"value": "First Name"
}
],
"registration.lastname": [
{
"type": 0,
"value": "Last Name"
}
],
"registration.password": [
{
"type": 0,
"value": "Password"
}
],
"registration.register": [ "registration.register": [
{ {
"type": 0, "type": 0,

View File

@ -24,12 +24,12 @@ const HistoryDialog = (props: DialogProps) => {
props.onClose(); props.onClose();
}; };
const handleOnClick = (event,vid): void => { const handleOnClick = (event, vid): void => {
event.preventDefault(); event.preventDefault();
client.revertHistory(mapId,vid) client.revertHistory(mapId, vid)
.then((mapId)=>{ .then((mapId) => {
handleOnClose(); handleOnClose();
}) })
}; };
@ -50,18 +50,25 @@ const HistoryDialog = (props: DialogProps) => {
</TableRow> </TableRow>
</TableHead> </TableHead>
<TableBody> <TableBody>
{changeHistory.map((row) => (
<TableRow key={row.id}> {changeHistory.length == 0 ? (
<TableCell align="left">{row.creator}</TableCell> <TableRow>
<TableCell align="left"> <TableCell colSpan={4}><FormattedMessage id='history.no-changes' defaultMessage='There is no changes available' />
<Tooltip title={moment(row.modified).format("lll")} placement="bottom-start">
<span>{moment(row.modified).fromNow()}</span>
</Tooltip>
</TableCell> </TableCell>
<TableCell align="left"><Link href={`c/maps/${mapId}/${row.id}/view`} target="history"><FormattedMessage id="maps.view" defaultMessage="View" /></Link></TableCell>
<TableCell align="left"><Link href="#" onClick={(e)=>handleOnClick(e,row.id)}><FormattedMessage id="maps.revert" defaultMessage="Revert" /></Link></TableCell>
</TableRow> </TableRow>
))} ) :
changeHistory.map((row) => (
<TableRow key={row.id}>
<TableCell align="left">{row.creator}</TableCell>
<TableCell align="left">
<Tooltip title={moment(row.modified).format("lll")} placement="bottom-start">
<span>{moment(row.modified).fromNow()}</span>
</Tooltip>
</TableCell>
<TableCell align="left"><Link href={`c/maps/${mapId}/${row.id}/view`} target="history"><FormattedMessage id="maps.view" defaultMessage="View" /></Link></TableCell>
<TableCell align="left"><Link href="#" onClick={(e) => handleOnClick(e, row.id)}><FormattedMessage id="maps.revert" defaultMessage="Revert" /></Link></TableCell>
</TableRow>
))}
</TableBody> </TableBody>
</Table> </Table>
</TableContainer> </TableContainer>