Skip to content

Commit

Permalink
Overview Alerts Histogram stacking defaults to signal.rule.name
Browse files Browse the repository at this point in the history
Since this is now the default for all AlertsHistograms, I've moved this
default upstream into the histogram itself.
  • Loading branch information
rylnd committed Jul 15, 2020
1 parent 755f9f4 commit 4f4f621
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -80,10 +80,14 @@ const getHistogramOption = (fieldName: string): MatrixHistogramOption => ({

const NO_LEGEND_DATA: LegendItem[] = [];

const DEFAULT_STACK_BY = 'signal.rule.name';
const getDefaultStackByOption = (): AlertsHistogramOption =>
alertsHistogramOptions.find(({ text }) => text === DEFAULT_STACK_BY) ?? alertsHistogramOptions[0];

export const AlertsHistogramPanel = memo<AlertsHistogramPanelProps>(
({
chartHeight,
defaultStackByOption = alertsHistogramOptions[8], // signal.rule.name
defaultStackByOption = getDefaultStackByOption(),
deleteQuery,
filters,
headerChildren,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ import { UpdateDateRange } from '../../../common/components/charts/common';
import { GlobalTimeArgs } from '../../../common/containers/use_global_time';

const DEFAULT_QUERY: Query = { query: '', language: 'kuery' };
const DEFAULT_STACK_BY = 'signal.rule.threat.tactic.name';
const NO_FILTERS: Filter[] = [];

interface Props extends Pick<GlobalTimeArgs, 'from' | 'to' | 'deleteQuery' | 'setQuery'> {
Expand Down Expand Up @@ -62,13 +61,9 @@ const SignalsByCategoryComponent: React.FC<Props> = ({
[setAbsoluteRangeDatePicker]
);

const defaultStackByOption =
alertsHistogramOptions.find((o) => o.text === DEFAULT_STACK_BY) ?? alertsHistogramOptions[0];

return (
<AlertsHistogramPanel
deleteQuery={deleteQuery}
defaultStackByOption={defaultStackByOption}
filters={filters}
from={from}
headerChildren={headerChildren}
Expand Down

0 comments on commit 4f4f621

Please sign in to comment.