| @@ -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.state.moreItemsPerPage = false; | |||||
| this.terminalRef = createRef(); | this.terminalRef = createRef(); | ||||
| } | } | ||||
| @@ -22,8 +23,11 @@ class WBLiveLogs extends Component { | |||||
| } | } | ||||
| fetchData() { | fetchData() { | ||||
| const { uuid, app, itemsPerPage } = this.props; | |||||
| const { page } = this.state; | |||||
| const { uuid, app } = this.props; | |||||
| let { itemsPerPage } = this.props; | |||||
| const { page, moreItemsPerPage } = this.state; | |||||
| if (moreItemsPerPage) | |||||
| itemsPerPage *= 10; | |||||
| const { arvHost, arvToken } = app.state; | const { arvHost, arvToken } = app.state; | ||||
| const filters = [ | const filters = [ | ||||
| [ 'object_uuid', '=', uuid ] | [ 'object_uuid', '=', uuid ] | ||||
| @@ -44,9 +48,16 @@ class WBLiveLogs extends Component { | |||||
| }); | }); | ||||
| } | } | ||||
| render({}, { content, page, numPages }) { | |||||
| render({}, { content, page, numPages, moreItemsPerPage }) { | |||||
| return ( | return ( | ||||
| <div> | <div> | ||||
| <div class="custom-control custom-switch"> | |||||
| <input type="checkbox" class="custom-control-input" id="morePerPageSwitch" | |||||
| checked = { moreItemsPerPage ? 'checked' : null } | |||||
| onchange={ e => { this.state.moreItemsPerPage = e.target.checked; | |||||
| this.state.page = 0; this.fetchData(); } } /> | |||||
| <label class="custom-control-label" for="morePerPageSwitch">More log entries per page</label> | |||||
| </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" ref={ this.terminalRef }> | <pre class="word-warp terminal" ref={ this.terminalRef }> | ||||
| @@ -58,7 +69,7 @@ class WBLiveLogs extends Component { | |||||
| } | } | ||||
| WBLiveLogs.defaultProps = { | WBLiveLogs.defaultProps = { | ||||
| itemsPerPage: 1000 | |||||
| itemsPerPage: 100 | |||||
| }; | }; | ||||
| export default WBLiveLogs; | export default WBLiveLogs; | ||||