| @@ -1,4 +1,4 @@ | |||||
| import { h, Component } from 'preact'; | |||||
| import { h, Component, createRef } from 'preact'; | |||||
| import makeArvadosRequest from 'make-arvados-request'; | import makeArvadosRequest from 'make-arvados-request'; | ||||
| import WBPagination from 'wb-pagination'; | import WBPagination from 'wb-pagination'; | ||||
| @@ -6,6 +6,7 @@ class WBLiveLogs extends Component { | |||||
| constructor(...args) { | constructor(...args) { | ||||
| super(...args); | super(...args); | ||||
| this.state.page = 0; | this.state.page = 0; | ||||
| this.terminalRef = createRef(); | |||||
| } | } | ||||
| componentDidMount() { | componentDidMount() { | ||||
| @@ -39,6 +40,7 @@ class WBLiveLogs extends Component { | |||||
| .map(a => a.properties.text.trim()).join('\n'), | .map(a => a.properties.text.trim()).join('\n'), | ||||
| numPages: Math.ceil(xhr.response.items_available / itemsPerPage) | numPages: Math.ceil(xhr.response.items_available / itemsPerPage) | ||||
| }); | }); | ||||
| this.terminalRef.current.scrollTo(0, 0); | |||||
| }); | }); | ||||
| } | } | ||||
| @@ -47,7 +49,7 @@ class WBLiveLogs extends Component { | |||||
| <div> | <div> | ||||
| <WBPagination activePage={ page } numPages={ numPages } | <WBPagination activePage={ page } numPages={ numPages } | ||||
| onPageChanged={ page => { this.state.page = page; this.fetchData(); } } /> | onPageChanged={ page => { this.state.page = page; this.fetchData(); } } /> | ||||
| <pre class="word-warp terminal"> | |||||
| <pre class="word-warp terminal" ref={ this.terminalRef }> | |||||
| { content } | { content } | ||||
| </pre> | </pre> | ||||
| </div> | </div> | ||||