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 {
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,
};
......
......@@ -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);
};
......
......@@ -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}
......
......@@ -201,7 +201,7 @@ export interface UpdateDatasourceInstancePayload {
export interface ToggleLogLevelPayload {
exploreId: ExploreId;
hiddenLogLevels: Set<LogLevel>;
hiddenLogLevels: LogLevel[];
}
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