Prevents query result cleaning when new query trransaction starts

This commit is contained in:
Dominik Prokop 2019-01-28 12:57:09 +01:00
parent c7e50a79d7
commit 2ff62c42ac
3 changed files with 9 additions and 9 deletions

View File

@ -49,7 +49,7 @@ function renderMetaItem(value: any, kind: LogsMetaKind) {
} }
interface Props { interface Props {
data: LogsModel; data?: LogsModel;
exploreId: string; exploreId: string;
highlighterExpressions: string[]; highlighterExpressions: string[];
loading: boolean; loading: boolean;
@ -165,6 +165,11 @@ export default class Logs extends PureComponent<Props, State> {
scanning, scanning,
scanRange, scanRange,
} = this.props; } = this.props;
if (!data) {
return null;
}
const { dedup, deferLogs, hiddenLogLevels, renderAll, showLocalTime, showUtc } = this.state; const { dedup, deferLogs, hiddenLogLevels, renderAll, showLocalTime, showUtc } = this.state;
let { showLabels } = this.state; let { showLabels } = this.state;
const hasData = data && data.rows && data.rows.length > 0; const hasData = data && data.rows && data.rows.length > 0;

View File

@ -47,12 +47,13 @@ export class LogsContainer extends PureComponent<LogsContainerProps> {
scanning, scanning,
scanRange, scanRange,
} = this.props; } = this.props;
return ( return (
<Panel label="Logs" loading={loading} isOpen={showingLogs} onToggle={this.onClickLogsButton}> <Panel label="Logs" loading={loading} isOpen={showingLogs} onToggle={this.onClickLogsButton}>
<Logs <Logs
data={logsResult} data={logsResult}
exploreId={exploreId} exploreId={exploreId}
key={logsResult.id} key={logsResult && logsResult.id}
highlighterExpressions={logsHighlighterExpressions} highlighterExpressions={logsHighlighterExpressions}
loading={loading} loading={loading}
onChangeTime={onChangeTime} onChangeTime={onChangeTime}

View File

@ -278,7 +278,7 @@ export const itemReducer = (state, action: Action): ExploreItemState => {
} }
case ActionTypes.QueryTransactionStart: { case ActionTypes.QueryTransactionStart: {
const { datasourceInstance, queryIntervals, queryTransactions } = state; const { queryTransactions } = state;
const { resultType, rowIndex, transaction } = action.payload; const { resultType, rowIndex, transaction } = action.payload;
// Discarding existing transactions of same type // Discarding existing transactions of same type
const remainingTransactions = queryTransactions.filter( const remainingTransactions = queryTransactions.filter(
@ -288,15 +288,9 @@ export const itemReducer = (state, action: Action): ExploreItemState => {
// Append new transaction // Append new transaction
const nextQueryTransactions: QueryTransaction[] = [...remainingTransactions, transaction]; const nextQueryTransactions: QueryTransaction[] = [...remainingTransactions, transaction];
const results = calculateResultsFromQueryTransactions(
nextQueryTransactions,
datasourceInstance,
queryIntervals.intervalMs
);
return { return {
...state, ...state,
...results,
queryTransactions: nextQueryTransactions, queryTransactions: nextQueryTransactions,
showingStartPage: false, showingStartPage: false,
}; };