Add support for new log type in frontend

This commit is contained in:
Tulir Asokan 2022-03-25 20:00:40 +02:00
parent 37c492cbf3
commit 8c6628470e
2 changed files with 8 additions and 2 deletions

View File

@ -26,11 +26,12 @@ class LogEntry extends PureComponent {
const line = this.props.line
if (line.nameLink) {
const modal = this.context
return (
return <>
<Link to={line.nameLink} onClick={modal.close}>
{line.name}
</Link>
)
{line.nameSuffix}
</>
}
return line.name
}

View File

@ -94,10 +94,15 @@ class Dashboard extends Component {
const processEntry = (entry) => {
entry.time = new Date(entry.time)
entry.nameSuffix = ""
if (entry.name.startsWith("maubot.")) {
entry.name = entry.name.substr("maubot.".length)
}
if (entry.name.startsWith("client.")) {
if (entry.name.endsWith(".crypto")) {
entry.name = entry.name.slice(0, -".crypto".length)
entry.nameSuffix = "/crypto"
}
entry.name = entry.name.substr("client.".length)
entry.nameLink = `/client/${entry.name}`
} else if (entry.name.startsWith("instance.")) {