Skip to content

Commit

Permalink
[ML] Fixes bug with category filtering flag for rare/population chart…
Browse files Browse the repository at this point in the history
…s. (#24901) (#24920)

Fixes a bug where the filtering limit of categories for the rare chart was actually applied to the population chart variant.
  • Loading branch information
walterra authored Nov 1, 2018
1 parent c300e25 commit 11429c8
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@ exports[`ExplorerChartLabelBadge Render the chart label in one line. 1`] = `
<span
className="ml-explorer-chart-label-detector"
>
high_sum(nginx.access.body_sent.bytes) over nginx.access.remote_ip (population-03)
<React.Fragment>
high_sum(nginx.access.body_sent.bytes) over nginx.access.remote_ip (population-03)
</React.Fragment>
<React.Fragment>
 – 
</React.Fragment>
Expand Down Expand Up @@ -64,7 +66,9 @@ exports[`ExplorerChartLabelBadge Render the chart label in two lines. 1`] = `
<span
className="ml-explorer-chart-label-detector"
>
high_sum(nginx.access.body_sent.bytes) over nginx.access.remote_ip (population-03)
<React.Fragment>
high_sum(nginx.access.body_sent.bytes) over nginx.access.remote_ip (population-03)
</React.Fragment>
<React.Fragment>
 
</React.Fragment>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,15 @@ import React from 'react';

import { ExplorerChartLabel } from './explorer_chart_label';

const DetectorLabel = <React.Fragment>{seriesConfig.detectorLabel}</React.Fragment>;

describe('ExplorerChartLabelBadge', () => {

test('Render the chart label in one line.', () => {

const wrapper = shallow(
<ExplorerChartLabel
detectorLabel={seriesConfig.detectorLabel}
detectorLabel={DetectorLabel}
entityFields={seriesConfig.entityFields}
infoTooltip={seriesConfig.infoTooltip}
wrapLabel={false}
Expand All @@ -32,7 +33,7 @@ describe('ExplorerChartLabelBadge', () => {

const wrapper = shallow(
<ExplorerChartLabel
detectorLabel={seriesConfig.detectorLabel}
detectorLabel={DetectorLabel}
entityFields={seriesConfig.entityFields}
infoTooltip={seriesConfig.infoTooltip}
wrapLabel={true}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -124,9 +124,9 @@ export class ExplorerChartDistribution extends React.Component {
.filter((d, i) => {
// only filter for rare charts
if (chartType === CHART_TYPE.EVENT_DISTRIBUTION) {
return true;
return (i < categoryLimit || d.key === highlight);
}
return (i < categoryLimit || d.key === highlight);
return true;
})
.map(d => d.key);

Expand Down

0 comments on commit 11429c8

Please sign in to comment.