|
1 | 1 | import React, { Component } from 'react';
|
2 | 2 | import { connect } from 'unistore/react';
|
3 | 3 | import actions, { UtilsApi } from '../../actions/actions';
|
4 |
| -import { GlobalState, LogMessage } from '../../store'; |
| 4 | +import store, { GlobalState, LogMessage } from '../../store'; |
5 | 5 | import cx from 'classnames';
|
6 | 6 | import escapeRegExp from 'lodash/escapeRegExp';
|
7 | 7 | import { BridgeApi } from '../../actions/BridgeApi';
|
@@ -71,6 +71,7 @@ export function LogRow(props: LogRowProps): JSX.Element {
|
71 | 71 | }
|
72 | 72 |
|
73 | 73 | const logLevels = [ALL, 'debug', 'info', 'warning', 'error'];
|
| 74 | +const logLimits = [100, 200, 500, 1000]; |
74 | 75 |
|
75 | 76 | type PropsFromStore = Pick<GlobalState, 'bridgeInfo' | 'logs'>;
|
76 | 77 | class LogsPage extends Component<PropsFromStore & BridgeApi & UtilsApi & WithTranslation<'logs'>, LogsPageState> {
|
@@ -125,6 +126,28 @@ class LogsPage extends Component<PropsFromStore & BridgeApi & UtilsApi & WithTra
|
125 | 126 | onChange={updateBridgeConfig}
|
126 | 127 | />
|
127 | 128 | </div>
|
| 129 | + <div className="col-12 col-sm-4 col-xxl-4"> |
| 130 | + <label htmlFor="logs-limit" className="form-label"> |
| 131 | + {t('logs_limit')} |
| 132 | + </label> |
| 133 | + <select |
| 134 | + id="logs-limit" |
| 135 | + className="form-select" |
| 136 | + onChange={(e) => { |
| 137 | + const limit = parseInt(e.target.value); |
| 138 | + store.setState({ |
| 139 | + logsLimit: limit, |
| 140 | + logs: [...store.getState().logs.slice(-limit)], |
| 141 | + }); |
| 142 | + }} |
| 143 | + > |
| 144 | + {logLimits.map((limit) => ( |
| 145 | + <option key={limit} value={limit} selected={limit == store.getState().logsLimit}> |
| 146 | + {limit} |
| 147 | + </option> |
| 148 | + ))} |
| 149 | + </select> |
| 150 | + </div> |
128 | 151 | <div className="col-12">
|
129 | 152 | <label htmlFor="reset"> </label>
|
130 | 153 | <input
|
|
0 commit comments