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

View File

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

View File

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