Skip to content

Commit d513d21

Browse files
committed
feat: dev filters for escalating, etc.
1 parent b873262 commit d513d21

File tree

1 file changed

+56
-3
lines changed

1 file changed

+56
-3
lines changed

static/app/views/issueList/pages/dynamicGrouping.tsx

Lines changed: 56 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -349,7 +349,13 @@ function ClusterIssues({groupIds}: {groupIds: number[]}) {
349349
);
350350
}
351351

352-
function ClusterCard({cluster}: {cluster: ClusterSummary}) {
352+
interface ClusterCardProps {
353+
cluster: ClusterSummary;
354+
filterByEscalating?: boolean;
355+
filterByRegressed?: boolean;
356+
}
357+
358+
function ClusterCard({cluster, filterByRegressed, filterByEscalating}: ClusterCardProps) {
353359
const api = useApi();
354360
const organization = useOrganization();
355361
const {selection} = usePageFilters();
@@ -455,6 +461,17 @@ function ClusterCard({cluster}: {cluster: ClusterSummary}) {
455461
];
456462
}, [cluster.error_type_tags, cluster.code_area_tags, cluster.service_tags]);
457463

464+
// Apply filters - hide card if it doesn't match active filters
465+
// Only filter once stats are loaded to avoid hiding cards prematurely
466+
if (!clusterStats.isPending) {
467+
if (filterByRegressed && !clusterStats.hasRegressedIssues) {
468+
return null;
469+
}
470+
if (filterByEscalating && !clusterStats.isEscalating) {
471+
return null;
472+
}
473+
}
474+
458475
return (
459476
<CardContainer>
460477
<CardHeader>
@@ -720,6 +737,8 @@ function DynamicGrouping() {
720737
const [disableFilters, setDisableFilters] = useState(false);
721738
const [showDevTools, setShowDevTools] = useState(false);
722739
const [visibleClusterCount, setVisibleClusterCount] = useState(CLUSTERS_PER_PAGE);
740+
const [filterByRegressed, setFilterByRegressed] = useState(false);
741+
const [filterByEscalating, setFilterByEscalating] = useState(false);
723742

724743
// Fetch cluster data from API
725744
const {data: topIssuesResponse, isPending} = useApiQuery<TopIssuesResponse>(
@@ -1046,6 +1065,30 @@ function DynamicGrouping() {
10461065
</Flex>
10471066
</Flex>
10481067
)}
1068+
1069+
<Flex direction="column" gap="sm">
1070+
<FilterLabel>{t('Filter by status')}</FilterLabel>
1071+
<Flex direction="column" gap="xs" style={{paddingLeft: 8}}>
1072+
<Flex gap="sm" align="center">
1073+
<Checkbox
1074+
checked={filterByRegressed}
1075+
onChange={e => setFilterByRegressed(e.target.checked)}
1076+
aria-label={t('Show only clusters with regressed issues')}
1077+
size="sm"
1078+
/>
1079+
<FilterLabel>{t('Has regressed issues')}</FilterLabel>
1080+
</Flex>
1081+
<Flex gap="sm" align="center">
1082+
<Checkbox
1083+
checked={filterByEscalating}
1084+
onChange={e => setFilterByEscalating(e.target.checked)}
1085+
aria-label={t('Show only escalating clusters')}
1086+
size="sm"
1087+
/>
1088+
<FilterLabel>{t('Escalating (>1.5x events)')}</FilterLabel>
1089+
</Flex>
1090+
</Flex>
1091+
</Flex>
10491092
</Flex>
10501093
</Disclosure.Content>
10511094
</Disclosure>
@@ -1070,14 +1113,24 @@ function DynamicGrouping() {
10701113
{displayedClusters
10711114
.filter((_, index) => index % 2 === 0)
10721115
.map(cluster => (
1073-
<ClusterCard key={cluster.cluster_id} cluster={cluster} />
1116+
<ClusterCard
1117+
key={cluster.cluster_id}
1118+
cluster={cluster}
1119+
filterByRegressed={filterByRegressed}
1120+
filterByEscalating={filterByEscalating}
1121+
/>
10741122
))}
10751123
</CardsColumn>
10761124
<CardsColumn>
10771125
{displayedClusters
10781126
.filter((_, index) => index % 2 === 1)
10791127
.map(cluster => (
1080-
<ClusterCard key={cluster.cluster_id} cluster={cluster} />
1128+
<ClusterCard
1129+
key={cluster.cluster_id}
1130+
cluster={cluster}
1131+
filterByRegressed={filterByRegressed}
1132+
filterByEscalating={filterByEscalating}
1133+
/>
10811134
))}
10821135
</CardsColumn>
10831136
</CardsGrid>

0 commit comments

Comments
 (0)