Commit 53db8235 by Marcus Efraimsson Committed by GitHub

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
parent c392a492
...@@ -79,7 +79,7 @@ interface GraphProps { ...@@ -79,7 +79,7 @@ interface GraphProps {
split?: boolean; split?: boolean;
userOptions?: any; userOptions?: any;
onChangeTime?: (range: AbsoluteTimeRange) => void; onChangeTime?: (range: AbsoluteTimeRange) => void;
onToggleSeries?: (alias: string, hiddenSeries: Set<string>) => void; onToggleSeries?: (alias: string, hiddenSeries: string[]) => void;
} }
interface GraphState { interface GraphState {
...@@ -218,8 +218,8 @@ export class Graph extends PureComponent<GraphProps, GraphState> { ...@@ -218,8 +218,8 @@ export class Graph extends PureComponent<GraphProps, GraphState> {
const exclusive = event.ctrlKey || event.metaKey || event.shiftKey; const exclusive = event.ctrlKey || event.metaKey || event.shiftKey;
this.setState((state, props) => { this.setState((state, props) => {
const { data } = props; const { data, onToggleSeries } = props;
let nextHiddenSeries = []; let nextHiddenSeries: string[] = [];
if (exclusive) { if (exclusive) {
// Toggling series with key makes the series itself to toggle // Toggling series with key makes the series itself to toggle
if (state.hiddenSeries.indexOf(label) > -1) { if (state.hiddenSeries.indexOf(label) > -1) {
...@@ -238,6 +238,10 @@ export class Graph extends PureComponent<GraphProps, GraphState> { ...@@ -238,6 +238,10 @@ export class Graph extends PureComponent<GraphProps, GraphState> {
} }
} }
if (onToggleSeries) {
onToggleSeries(label, nextHiddenSeries);
}
return { return {
hiddenSeries: nextHiddenSeries, hiddenSeries: nextHiddenSeries,
}; };
......
...@@ -68,7 +68,7 @@ interface Props { ...@@ -68,7 +68,7 @@ interface Props {
onStartScanning?: () => void; onStartScanning?: () => void;
onStopScanning?: () => void; onStopScanning?: () => void;
onDedupStrategyChange: (dedupStrategy: LogsDedupStrategy) => void; onDedupStrategyChange: (dedupStrategy: LogsDedupStrategy) => void;
onToggleLogLevel: (hiddenLogLevels: Set<LogLevel>) => void; onToggleLogLevel: (hiddenLogLevels: LogLevel[]) => void;
getRowContext?: (row: LogRowModel, options?: any) => Promise<any>; getRowContext?: (row: LogRowModel, options?: any) => Promise<any>;
} }
...@@ -135,8 +135,8 @@ export default class Logs extends PureComponent<Props, State> { ...@@ -135,8 +135,8 @@ export default class Logs extends PureComponent<Props, State> {
}); });
}; };
onToggleLogLevel = (rawLevel: string, hiddenRawLevels: Set<string>) => { onToggleLogLevel = (rawLevel: string, hiddenRawLevels: string[]) => {
const hiddenLogLevels: Set<LogLevel> = new Set(Array.from(hiddenRawLevels).map(level => LogLevel[level])); const hiddenLogLevels: LogLevel[] = hiddenRawLevels.map(level => LogLevel[level]);
this.props.onToggleLogLevel(hiddenLogLevels); this.props.onToggleLogLevel(hiddenLogLevels);
}; };
......
...@@ -68,7 +68,7 @@ export class LogsContainer extends Component<LogsContainerProps> { ...@@ -68,7 +68,7 @@ export class LogsContainer extends Component<LogsContainerProps> {
this.props.changeDedupStrategy(this.props.exploreId, dedupStrategy); this.props.changeDedupStrategy(this.props.exploreId, dedupStrategy);
}; };
hangleToggleLogLevel = (hiddenLogLevels: Set<LogLevel>) => { handleToggleLogLevel = (hiddenLogLevels: LogLevel[]) => {
const { exploreId } = this.props; const { exploreId } = this.props;
this.props.toggleLogLevelAction({ this.props.toggleLogLevelAction({
exploreId, exploreId,
...@@ -93,6 +93,7 @@ export class LogsContainer extends Component<LogsContainerProps> { ...@@ -93,6 +93,7 @@ export class LogsContainer extends Component<LogsContainerProps> {
nextProps.loading !== this.props.loading || nextProps.loading !== this.props.loading ||
nextProps.dedupStrategy !== this.props.dedupStrategy || nextProps.dedupStrategy !== this.props.dedupStrategy ||
nextProps.logsHighlighterExpressions !== this.props.logsHighlighterExpressions || nextProps.logsHighlighterExpressions !== this.props.logsHighlighterExpressions ||
nextProps.hiddenLogLevels !== this.props.hiddenLogLevels ||
nextProps.scanning !== this.props.scanning || nextProps.scanning !== this.props.scanning ||
nextProps.isLive !== this.props.isLive nextProps.isLive !== this.props.isLive
); );
...@@ -139,7 +140,7 @@ export class LogsContainer extends Component<LogsContainerProps> { ...@@ -139,7 +140,7 @@ export class LogsContainer extends Component<LogsContainerProps> {
onStartScanning={onStartScanning} onStartScanning={onStartScanning}
onStopScanning={onStopScanning} onStopScanning={onStopScanning}
onDedupStrategyChange={this.handleDedupStrategyChange} onDedupStrategyChange={this.handleDedupStrategyChange}
onToggleLogLevel={this.hangleToggleLogLevel} onToggleLogLevel={this.handleToggleLogLevel}
absoluteRange={absoluteRange} absoluteRange={absoluteRange}
timeZone={timeZone} timeZone={timeZone}
scanning={scanning} scanning={scanning}
......
...@@ -201,7 +201,7 @@ export interface UpdateDatasourceInstancePayload { ...@@ -201,7 +201,7 @@ export interface UpdateDatasourceInstancePayload {
export interface ToggleLogLevelPayload { export interface ToggleLogLevelPayload {
exploreId: ExploreId; exploreId: ExploreId;
hiddenLogLevels: Set<LogLevel>; hiddenLogLevels: LogLevel[];
} }
export interface QueriesImportedPayload { export interface QueriesImportedPayload {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment