-
-
Notifications
You must be signed in to change notification settings - Fork 4.5k
fix(aci): Apply chart zoom on automation history #103392
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,8 +1,8 @@ | ||
| import styled from '@emotion/styled'; | ||
|
|
||
| import {BarChart} from 'sentry/components/charts/barChart'; | ||
| import ChartZoom from 'sentry/components/charts/chartZoom'; | ||
| import {HeaderTitleLegend} from 'sentry/components/charts/styles'; | ||
| import {useChartZoom} from 'sentry/components/charts/useChartZoom'; | ||
| import type {DateTimeObject} from 'sentry/components/charts/utils'; | ||
| import LoadingError from 'sentry/components/loadingError'; | ||
| import Panel from 'sentry/components/panels/panel'; | ||
|
|
@@ -28,6 +28,7 @@ export function AutomationStatsChart({ | |
| utc, | ||
| }: IssueAlertDetailsProps) { | ||
| const organization = useOrganization(); | ||
| const chartZoomProps = useChartZoom({saveOnZoom: true}); | ||
| const { | ||
|
Comment on lines
+31
to
32
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Bug: The 🔍 Detailed AnalysisThe 💡 Suggested FixModify the 🤖 Prompt for AI AgentDid we get this right? 👍 / 👎 to inform future reviews. Reference_id: 2695024 |
||
| data: fireHistory, | ||
| isPending, | ||
|
|
@@ -59,37 +60,32 @@ export function AutomationStatsChart({ | |
| {isPending && <Placeholder height="200px" />} | ||
| {isError && <LoadingError />} | ||
| {fireHistory && ( | ||
| <ChartZoom period={period} start={start} end={end} utc={utc} usePageDate> | ||
| {zoomRenderProps => ( | ||
| <BarChart | ||
| {...zoomRenderProps} | ||
| isGroupedByDate | ||
| showTimeInTooltip | ||
| grid={{ | ||
| left: space(0.25), | ||
| right: space(2), | ||
| top: space(3), | ||
| bottom: 0, | ||
| }} | ||
| yAxis={{ | ||
| minInterval: 1, | ||
| }} | ||
| series={[ | ||
| { | ||
| seriesName: t('Alerts Triggered'), | ||
| data: | ||
| fireHistory?.map(automation => ({ | ||
| name: automation.date, | ||
| value: automation.count, | ||
| })) ?? [], | ||
| emphasis: { | ||
| disabled: true, | ||
| }, | ||
| }, | ||
| ]} | ||
| /> | ||
| )} | ||
| </ChartZoom> | ||
| <BarChart | ||
| {...chartZoomProps} | ||
| showTimeInTooltip | ||
| grid={{ | ||
| left: space(0.25), | ||
| right: space(2), | ||
| top: space(3), | ||
| bottom: 0, | ||
| }} | ||
| yAxis={{ | ||
| minInterval: 1, | ||
| }} | ||
| series={[ | ||
| { | ||
| seriesName: t('Alerts Triggered'), | ||
| data: fireHistory.map(automation => ({ | ||
| name: automation.date, | ||
| value: automation.count, | ||
| })), | ||
| emphasis: { | ||
| disabled: true, | ||
| }, | ||
| animation: false, | ||
| }, | ||
| ]} | ||
| /> | ||
| )} | ||
| </StyledPanelBody> | ||
| <ChartFooter> | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Bug: Chart Zoom Overwrites Global Filters
The
useChartZoomhook is configured withsaveOnZoom: trueinstead ofusePageDate: true. This causes chart zoom to update the global page filters viaupdateDateTimerather than setting page-specific query parameters like the previousChartZoomcomponent did. The old code usedusePageDateto persist zoom state to query params without affecting page filters, but the new implementation will modify global filters instead.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i think this is what i want