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 const line = this.props.line
if (line.nameLink) { if (line.nameLink) {
const modal = this.context const modal = this.context
return ( return <>
<Link to={line.nameLink} onClick={modal.close}> <Link to={line.nameLink} onClick={modal.close}>
{line.name} {line.name}
</Link> </Link>
) {line.nameSuffix}
</>
} }
return line.name return line.name
} }

View file

@ -94,10 +94,15 @@ class Dashboard extends Component {
const processEntry = (entry) => { const processEntry = (entry) => {
entry.time = new Date(entry.time) entry.time = new Date(entry.time)
entry.nameSuffix = ""
if (entry.name.startsWith("maubot.")) { if (entry.name.startsWith("maubot.")) {
entry.name = entry.name.substr("maubot.".length) entry.name = entry.name.substr("maubot.".length)
} }
if (entry.name.startsWith("client.")) { 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.name = entry.name.substr("client.".length)
entry.nameLink = `/client/${entry.name}` entry.nameLink = `/client/${entry.name}`
} else if (entry.name.startsWith("instance.")) { } else if (entry.name.startsWith("instance.")) {