-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
display list of logs on separate tab #8
- Loading branch information
1 parent
c797ea5
commit 149739b
Showing
4 changed files
with
62 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
import { observer, inject } from 'mobx-react'; | ||
void(inject); void(observer); // just to silence eslint, which cannot detect decorators usage | ||
|
||
import React from 'react'; | ||
import moment from 'moment'; | ||
|
||
import MarkedOutput from '../components/MarkedOutput'; | ||
|
||
|
||
|
||
const formatTimestamp = (mcs) => { | ||
const m = moment(Math.floor(mcs/1000)); | ||
const ms = Math.floor((mcs % (1000*1000))/1000); | ||
return `${m.format('HH:mm:ss')}.${ms}`; | ||
}; | ||
|
||
|
||
|
||
@inject("store") @observer | ||
export default class LogsPage extends React.Component { | ||
constructor() { | ||
super(); | ||
|
||
this.renderItem = this.renderItem.bind(this); | ||
} | ||
|
||
renderItem({ Pid, At, text, module, line, 'function': fun }) { | ||
const key = `${At} ${Pid}`; | ||
const instanceId = this.props.match.params.id; | ||
const text1 = `${formatTimestamp(At)} ${Pid} ${module}:${line} ${text}`; | ||
return <MarkedOutput key={key} text={text1} instanceId={instanceId} store={this.props.store} />; | ||
} | ||
|
||
render() { | ||
const logs = this.props.store.orderedLogs; | ||
|
||
return <div className="LogsPage"> | ||
{logs.map(this.renderItem)} | ||
</div>; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters