Skip to content

Commit e355995

Browse files
authored
fix: pass sidebar filters to alert preview chart (#1902)
## Summary - Thread `filters` from `searchedConfig` through `DBSearchPageAlertModal` → `AlertForm` → `AlertPreviewChart` → `DBTimeChart` config - The alert preview chart now respects sidebar filtering instead of showing unfiltered data Fixes HDX-3691 ## Test plan - [x] Apply sidebar filters on the search page - [x] Open the alert modal and check the preview chart reflects the applied filters - [x] Verify the chart updates when filters are changed
1 parent 11f86ce commit e355995

3 files changed

Lines changed: 14 additions & 0 deletions

File tree

‎.changeset/seven-olives-unite.md‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@hyperdx/app": patch
3+
---
4+
5+
fix: pass sidebar filters to alert preview chart

‎packages/app/src/DBSearchPageAlertModal.tsx‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import {
1010
AlertIntervalSchema,
1111
AlertSource,
1212
AlertThresholdType,
13+
Filter,
1314
scheduleStartAtSchema,
1415
SearchCondition,
1516
SearchConditionLanguage,
@@ -75,6 +76,7 @@ const AlertForm = ({
7576
sourceId,
7677
where,
7778
whereLanguage,
79+
filters,
7880
select,
7981
defaultValues,
8082
loading,
@@ -87,6 +89,7 @@ const AlertForm = ({
8789
sourceId?: string | null;
8890
where?: SearchCondition | null;
8991
whereLanguage?: SearchConditionLanguage | null;
92+
filters?: Filter[] | null;
9093
select?: string | null;
9194
defaultValues?: null | AlertWithCreatedBy;
9295
loading?: boolean;
@@ -247,6 +250,7 @@ const AlertForm = ({
247250
source={source}
248251
where={where}
249252
whereLanguage={whereLanguage}
253+
filters={filters}
250254
select={select}
251255
interval={interval}
252256
groupBy={groupByValue}
@@ -490,6 +494,7 @@ export const DBSearchPageAlertModal = ({
490494
sourceId={searchedConfig?.source}
491495
where={searchedConfig?.where}
492496
whereLanguage={searchedConfig?.whereLanguage}
497+
filters={searchedConfig?.filters}
493498
select={searchedConfig?.select}
494499
defaultValues={
495500
activeIndex === 'stage'

‎packages/app/src/components/AlertPreviewChart.tsx‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import React from 'react';
22
import { aliasMapToWithClauses } from '@hyperdx/common-utils/dist/core/utils';
33
import {
44
AlertInterval,
5+
Filter,
56
SearchCondition,
67
SearchConditionLanguage,
78
} from '@hyperdx/common-utils/dist/types';
@@ -18,6 +19,7 @@ export type AlertPreviewChartProps = {
1819
source: TSource;
1920
where?: SearchCondition | null;
2021
whereLanguage?: SearchConditionLanguage | null;
22+
filters?: Filter[] | null;
2123
interval: AlertInterval;
2224
groupBy?: string;
2325
thresholdType: 'above' | 'below';
@@ -29,6 +31,7 @@ export const AlertPreviewChart = ({
2931
source,
3032
where,
3133
whereLanguage,
34+
filters,
3235
interval,
3336
groupBy,
3437
threshold,
@@ -62,6 +65,7 @@ export const AlertPreviewChart = ({
6265
whereLanguage: whereLanguage || undefined,
6366
dateRange: intervalToDateRange(interval),
6467
granularity: intervalToGranularity(interval),
68+
filters: filters || undefined,
6569
implicitColumnExpression: source.implicitColumnExpression,
6670
groupBy,
6771
with: aliasWith,

0 commit comments

Comments
 (0)