Skip to content

Commit dfb4d32

Browse files
committed
fix(ui): TE-2647 anomaly list filter with multiple alert fix
1 parent 8b7d79c commit dfb4d32

File tree

3 files changed

+8
-3
lines changed

3 files changed

+8
-3
lines changed

thirdeye-ui/src/app/pages/anomalies-all-page/anomalies-all-page.component.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -77,9 +77,9 @@ export const AnomaliesAllPage: FunctionComponent = () => {
7777
const anomalyFilters = useMemo(() => {
7878
const params: GetAnomaliesProps = {};
7979
if (searchParams.has(AnomalyFilterQueryStringKey.ALERT)) {
80-
params.alertId = parseInt(
81-
searchParams.get(AnomalyFilterQueryStringKey.ALERT) || ""
82-
);
80+
const alertIds =
81+
searchParams.getAll(AnomalyFilterQueryStringKey.ALERT) || [];
82+
params.alertIds = alertIds.map((id) => parseInt(id));
8383
}
8484

8585
if (searchParams.has(AnomalyFilterQueryStringKey.DATASET)) {

thirdeye-ui/src/app/rest/anomalies/anomalies.rest.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ export const getAnomaly = async (id: number): Promise<Anomaly> => {
3535

3636
export const getAnomalies = async ({
3737
alertId,
38+
alertIds,
3839
startTime,
3940
endTime,
4041
dataset,
@@ -47,6 +48,9 @@ export const getAnomalies = async ({
4748
if (alertId) {
4849
queryParams.set("alert.id", alertId.toString());
4950
}
51+
if (alertIds) {
52+
queryParams.set("alert.id", `[in]${alertIds.join(",")}`);
53+
}
5054

5155
if (startTime) {
5256
queryParams.set("startTime", `[gte]${startTime}`);

thirdeye-ui/src/app/rest/anomalies/anomaly.interfaces.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ export interface GetAnomalies extends ActionHook {
3232

3333
export interface GetAnomaliesProps {
3434
alertId?: number | string;
35+
alertIds?: number[] | string[];
3536
startTime?: number;
3637
endTime?: number;
3738
dataset?: string;

0 commit comments

Comments
 (0)