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": {
"defaultMessage": "We will send you an email to reset your password"
},
"forgot.email": {
"defaultMessage": "Email"
},
"forgot.register": {
"defaultMessage": "Send recovery link"
},
@ -128,6 +131,9 @@
"header.haveaccount": {
"defaultMessage": "Already have an account?"
},
"history.no-changes": {
"defaultMessage": "There is no changes available"
},
"login.desc": {
"defaultMessage": "Log into your account"
},
@ -198,6 +204,18 @@
"registration.desc": {
"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": {
"defaultMessage": "Register"
},

View File

@ -221,6 +221,12 @@
"value": "We will send you an email to reset your password"
}
],
"forgot.email": [
{
"type": 0,
"value": "Email"
}
],
"forgot.register": [
{
"type": 0,
@ -257,6 +263,12 @@
"value": "Already have an account?"
}
],
"history.no-changes": [
{
"type": 0,
"value": "There is no changes available"
}
],
"login.desc": [
{
"type": 0,
@ -395,6 +407,30 @@
"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": [
{
"type": 0,

View File

@ -24,12 +24,12 @@ const HistoryDialog = (props: DialogProps) => {
props.onClose();
};
const handleOnClick = (event,vid): void => {
const handleOnClick = (event, vid): void => {
event.preventDefault();
client.revertHistory(mapId,vid)
.then((mapId)=>{
handleOnClose();
})
client.revertHistory(mapId, vid)
.then((mapId) => {
handleOnClose();
})
};
@ -50,18 +50,25 @@ const HistoryDialog = (props: DialogProps) => {
</TableRow>
</TableHead>
<TableBody>
{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>
{changeHistory.length == 0 ? (
<TableRow>
<TableCell colSpan={4}><FormattedMessage id='history.no-changes' defaultMessage='There is no changes available' />
</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>
))}
) :
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>
</Table>
</TableContainer>