Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(ui): made alert wizard chart consistent with Discover #29397

Merged
merged 1 commit into from
Oct 18, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ import color from 'color';
import debounce from 'lodash/debounce';
import flatten from 'lodash/flatten';

import AreaChart, {AreaChartSeries} from 'app/components/charts/areaChart';
import Graphic from 'app/components/charts/components/graphic';
import LineChart, {LineChartSeries} from 'app/components/charts/lineChart';
import space from 'app/styles/space';
import {GlobalSelection} from 'app/types';
import {ReactEchartsRef, Series} from 'app/types/echarts';
Expand All @@ -21,7 +21,7 @@ import {AlertRuleThresholdType, IncidentRule, Trigger} from '../../types';

type DefaultProps = {
data: Series[];
comparisonMarkLines: LineChartSeries[];
comparisonMarkLines: AreaChartSeries[];
};

type Props = DefaultProps & {
Expand Down Expand Up @@ -290,7 +290,7 @@ export default class ThresholdsChart extends PureComponent<Props, State> {

render() {
const {data, triggers, period, aggregate, comparisonMarkLines} = this.props;
const dataWithoutRecentBucket: LineChartSeries[] = data?.map(
const dataWithoutRecentBucket: AreaChartSeries[] = data?.map(
({data: eventData, ...restOfData}) => ({
...restOfData,
data: eventData.slice(0, -1),
Expand Down Expand Up @@ -327,7 +327,7 @@ export default class ThresholdsChart extends PureComponent<Props, State> {
},
};
return (
<LineChart
<AreaChart
isGroupedByDate
showTimeInTooltip
period={period}
Expand Down
18 changes: 9 additions & 9 deletions tests/js/spec/views/alerts/incidentRules/triggersChart.spec.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@ import {mountWithTheme} from 'sentry-test/enzyme';
import {initializeOrg} from 'sentry-test/initializeOrg';

import {Client} from 'app/api';
import LineChart from 'app/components/charts/lineChart';
import AreaChart from 'app/components/charts/areaChart';
import TriggersChart from 'app/views/alerts/incidentRules/triggers/chart';

jest.mock('app/components/charts/lineChart');
jest.mock('app/components/charts/areaChart');

describe('Incident Rules Create', () => {
let eventStatsMock;
Expand All @@ -14,7 +14,7 @@ describe('Incident Rules Create', () => {

beforeEach(() => {
MockApiClient.clearMockResponses();
LineChart.default = jest.fn(() => null);
AreaChart.default = jest.fn(() => null);
api = new Client();
eventStatsMock = MockApiClient.addMockResponse({
url: '/organizations/org-slug/events-stats/',
Expand Down Expand Up @@ -73,7 +73,7 @@ describe('Incident Rules Create', () => {
})
);

expect(LineChart).toHaveBeenCalledWith(
expect(AreaChart).toHaveBeenCalledWith(
expect.objectContaining({
series: [{data: expect.objectContaining({length: 1}), seriesName: 'count()'}],
}),
Expand Down Expand Up @@ -137,15 +137,15 @@ describe('Incident Rules Create', () => {
);

// "series" accessed directly to assist with jest diff
expect(LineChart.mock.calls[0][0].series).toEqual([
expect(AreaChart.mock.calls[0][0].series).toEqual([
{data: expect.anything(), seriesName: 'count()'},
{data: expect.anything(), seriesName: 'Minimum'},
{data: expect.anything(), seriesName: 'Average'},
{data: expect.anything(), seriesName: 'Maximum'},
]);
expect(LineChart.mock.calls[0][0].series[0].data).toHaveLength(1199);
expect(LineChart.mock.calls[0][0].series[1].data).toHaveLength(239);
expect(LineChart.mock.calls[0][0].series[2].data).toHaveLength(239);
expect(LineChart.mock.calls[0][0].series[3].data).toHaveLength(239);
expect(AreaChart.mock.calls[0][0].series[0].data).toHaveLength(1199);
expect(AreaChart.mock.calls[0][0].series[1].data).toHaveLength(239);
expect(AreaChart.mock.calls[0][0].series[2].data).toHaveLength(239);
expect(AreaChart.mock.calls[0][0].series[3].data).toHaveLength(239);
});
});