Explore: Fix filter by series level in logs graph (#17798)

Adds back support for filtering log messages by series level 
in logs graph which seem to have been broken since merging
of #17027.

Fixes #17769
This commit is contained in:
Marcus Efraimsson 2019-06-28 17:05:59 +02:00 committed by GitHub
parent c392a492ae
commit 53db823511
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 14 additions and 9 deletions

View File

@ -79,7 +79,7 @@ interface GraphProps {
split?: boolean;
userOptions?: any;
onChangeTime?: (range: AbsoluteTimeRange) => void;
onToggleSeries?: (alias: string, hiddenSeries: Set<string>) => void;
onToggleSeries?: (alias: string, hiddenSeries: string[]) => void;
}
interface GraphState {
@ -218,8 +218,8 @@ export class Graph extends PureComponent<GraphProps, GraphState> {
const exclusive = event.ctrlKey || event.metaKey || event.shiftKey;
this.setState((state, props) => {
const { data } = props;
let nextHiddenSeries = [];
const { data, onToggleSeries } = props;
let nextHiddenSeries: string[] = [];
if (exclusive) {
// Toggling series with key makes the series itself to toggle
if (state.hiddenSeries.indexOf(label) > -1) {
@ -238,6 +238,10 @@ export class Graph extends PureComponent<GraphProps, GraphState> {
}
}
if (onToggleSeries) {
onToggleSeries(label, nextHiddenSeries);
}
return {
hiddenSeries: nextHiddenSeries,
};

View File

@ -68,7 +68,7 @@ interface Props {
onStartScanning?: () => void;
onStopScanning?: () => void;
onDedupStrategyChange: (dedupStrategy: LogsDedupStrategy) => void;
onToggleLogLevel: (hiddenLogLevels: Set<LogLevel>) => void;
onToggleLogLevel: (hiddenLogLevels: LogLevel[]) => void;
getRowContext?: (row: LogRowModel, options?: any) => Promise<any>;
}
@ -135,8 +135,8 @@ export default class Logs extends PureComponent<Props, State> {
});
};
onToggleLogLevel = (rawLevel: string, hiddenRawLevels: Set<string>) => {
const hiddenLogLevels: Set<LogLevel> = new Set(Array.from(hiddenRawLevels).map(level => LogLevel[level]));
onToggleLogLevel = (rawLevel: string, hiddenRawLevels: string[]) => {
const hiddenLogLevels: LogLevel[] = hiddenRawLevels.map(level => LogLevel[level]);
this.props.onToggleLogLevel(hiddenLogLevels);
};

View File

@ -68,7 +68,7 @@ export class LogsContainer extends Component<LogsContainerProps> {
this.props.changeDedupStrategy(this.props.exploreId, dedupStrategy);
};
hangleToggleLogLevel = (hiddenLogLevels: Set<LogLevel>) => {
handleToggleLogLevel = (hiddenLogLevels: LogLevel[]) => {
const { exploreId } = this.props;
this.props.toggleLogLevelAction({
exploreId,
@ -93,6 +93,7 @@ export class LogsContainer extends Component<LogsContainerProps> {
nextProps.loading !== this.props.loading ||
nextProps.dedupStrategy !== this.props.dedupStrategy ||
nextProps.logsHighlighterExpressions !== this.props.logsHighlighterExpressions ||
nextProps.hiddenLogLevels !== this.props.hiddenLogLevels ||
nextProps.scanning !== this.props.scanning ||
nextProps.isLive !== this.props.isLive
);
@ -139,7 +140,7 @@ export class LogsContainer extends Component<LogsContainerProps> {
onStartScanning={onStartScanning}
onStopScanning={onStopScanning}
onDedupStrategyChange={this.handleDedupStrategyChange}
onToggleLogLevel={this.hangleToggleLogLevel}
onToggleLogLevel={this.handleToggleLogLevel}
absoluteRange={absoluteRange}
timeZone={timeZone}
scanning={scanning}

View File

@ -201,7 +201,7 @@ export interface UpdateDatasourceInstancePayload {
export interface ToggleLogLevelPayload {
exploreId: ExploreId;
hiddenLogLevels: Set<LogLevel>;
hiddenLogLevels: LogLevel[];
}
export interface QueriesImportedPayload {