[Response Ops][Cases] Fix alerts tab in cases detail page (#208672)

## Summary

Closes https://github.com/elastic/kibana/issues/208290

Rollback `includeComments` in `resolve` case endpoint to fix the alerts
tab in cases detail page. I'll create a new issue to use an alternative
approach to get the data needed by the alerts tab.

#### To do (might be shipped after FF):
- [ ] Test the alert tab shows the right amount of alerts in header
- [ ] Test the alert tab shows the alerts in content table

### QA
- Create alerts in security
- Add an alert to a case
- Check:
<details>
<summary>that number of alerts isn't 0 and the alert commet in activity
list exist</summary>
<img width="1022" alt="Screenshot 2025-01-29 at 06 53 10"
src="https://github.com/user-attachments/assets/0a95ee88-4c00-4a53-88a7-563560351a73"
/>

</details>
<details>
  <summary>Table with alert is rendered when in alerts tab</summary>
<img width="559" alt="Screenshot 2025-01-29 at 06 57 27"
src="https://github.com/user-attachments/assets/95242c57-6eac-42e5-9801-534c8d7d6577"
/>

</details>
This commit is contained in:
Julian Gernun 2025-01-29 10:59:03 +01:00 committed by GitHub
parent 4cf60d60cf
commit 2063855283
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 15 additions and 3 deletions

View file

@ -151,6 +151,9 @@ describe('Cases API', () => {
await resolveCase({ caseId, signal: abortCtrl.signal });
expect(fetchMock).toHaveBeenCalledWith(`${CASES_URL}/${caseId}/resolve`, {
method: 'GET',
query: {
includeComments: true,
},
signal: abortCtrl.signal,
});
});

View file

@ -117,6 +117,7 @@ export const resolveCase = async ({
`${getCaseDetailsUrl(caseId)}/resolve`,
{
method: 'GET',
query: { includeComments: true },
signal,
}
);

View file

@ -60,7 +60,15 @@ export const resolveCaseRoute = createCasesRoute({
routerOptions: {
access: 'internal',
},
params,
params: {
...params,
query: schema.object({
/**
* @deprecated since version 8.1.0
*/
includeComments: schema.boolean({ defaultValue: true, meta: { deprecated: true } }),
}),
},
handler: async ({ context, request, response }) => {
try {
const caseContext = await context.cases;
@ -69,7 +77,7 @@ export const resolveCaseRoute = createCasesRoute({
const res: caseApiV1.CaseResolveResponse = await casesClient.cases.resolve({
id,
includeComments: false,
includeComments: request.query.includeComments,
});
return response.ok({
@ -77,7 +85,7 @@ export const resolveCaseRoute = createCasesRoute({
});
} catch (error) {
throw createCaseError({
message: `Failed to retrieve case in resolve route case id: ${request.params.case_id} \n${error}`,
message: `Failed to retrieve case in resolve route case id: ${request.params.case_id} \ninclude comments: ${request.query.includeComments}: ${error}`,
error,
});
}