From 9c164f9f769a111ac0708b02638d571d61f0327c Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Thu, 31 Oct 2024 02:20:59 +0000 Subject: [PATCH] use datasource id when getting client for threat alerts (#1218) Signed-off-by: Amardeepsingh Siglani (cherry picked from commit c20363bdb43bb461bb8677ba7208aab3faa9ef69) Signed-off-by: github-actions[bot] --- server/services/AlertService.ts | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/server/services/AlertService.ts b/server/services/AlertService.ts index 590d39f1..96a2bea1 100644 --- a/server/services/AlertService.ts +++ b/server/services/AlertService.ts @@ -127,10 +127,15 @@ export default class AlertService extends MDSEnabledClientService { response: OpenSearchDashboardsResponseFactory ): Promise | ResponseError>> => { try { - const params: any = request.query; - // Delete the dataSourceId since this query param is not supported by the alerts API - delete params['dataSourceId']; + const { sortOrder, size, startIndex, startTime, endTime } = request.query; + const params: any = { + sortOrder, + size, + startIndex, + startTime, + endTime, + }; const client = this.getClient(request, context); const getAlertsResponse: GetAlertsResponse = await client( CLIENT_THREAT_INTEL_METHODS.GET_THREAT_INTEL_ALERTS, @@ -167,11 +172,10 @@ export default class AlertService extends MDSEnabledClientService { response: OpenSearchDashboardsResponseFactory ): Promise | ResponseError>> => { try { - const params: any = request.query; - // Delete the dataSourceId since this query param is not supported by the alerts API - delete params['dataSourceId']; - + const { state, alert_ids } = request.query; + const params: any = { state, alert_ids }; const client = this.getClient(request, context); + const updateStatusResponse: GetAlertsResponse = await client( CLIENT_THREAT_INTEL_METHODS.UPDATE_THREAT_INTEL_ALERTS_STATE, params