Merge: - client: add initial flag for getLogs

* commit 'dd37c9651a0a5914a5e8c9be4c2f6ad23faf1a13':
  - client: add initial flag for getLogs
This commit is contained in:
Ildar Kamalov 2020-01-30 18:59:28 +03:00
commit be93dc3482
2 changed files with 6 additions and 5 deletions

View File

@ -25,7 +25,8 @@ import './Logs.css';
import CellWrap from '../ui/CellWrap'; import CellWrap from '../ui/CellWrap';
const TABLE_FIRST_PAGE = 0; const TABLE_FIRST_PAGE = 0;
const INITIAL_REQUEST_DATA = ['', TABLE_FIRST_PAGE, TABLE_DEFAULT_PAGE_SIZE]; const INITIAL_REQUEST = true;
const INITIAL_REQUEST_DATA = ['', TABLE_FIRST_PAGE, INITIAL_REQUEST];
const FILTERED_REASON = 'Filtered'; const FILTERED_REASON = 'Filtered';
class Logs extends Component { class Logs extends Component {
@ -36,10 +37,10 @@ class Logs extends Component {
this.props.getLogsConfig(); this.props.getLogsConfig();
} }
getLogs = (older_than, page) => { getLogs = (older_than, page, initial) => {
if (this.props.queryLogs.enabled) { if (this.props.queryLogs.enabled) {
this.props.getLogs({ this.props.getLogs({
older_than, page, pageSize: TABLE_DEFAULT_PAGE_SIZE, older_than, page, pageSize: TABLE_DEFAULT_PAGE_SIZE, initial,
}); });
} }
}; };

View File

@ -56,9 +56,9 @@ const queryLogs = handleActions(
[actions.getLogsFailure]: state => ({ ...state, processingGetLogs: false }), [actions.getLogsFailure]: state => ({ ...state, processingGetLogs: false }),
[actions.getLogsSuccess]: (state, { payload }) => { [actions.getLogsSuccess]: (state, { payload }) => {
const { const {
logs, oldest, older_than, page, pageSize, logs, oldest, older_than, page, pageSize, initial,
} = payload; } = payload;
let logsWithOffset = state.allLogs.length > 0 ? state.allLogs : logs; let logsWithOffset = state.allLogs.length > 0 && !initial ? state.allLogs : logs;
let allLogs = logs; let allLogs = logs;
if (older_than) { if (older_than) {