Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ResponseOps][Cases] Allow users to edit or delete template #185877

Merged

Conversation

js-jankisalvi
Copy link
Contributor

@js-jankisalvi js-jankisalvi commented Jun 10, 2024

Summary

Merging into feature branch.

Implements edit and delete functionality #181864

Edit or delete template from case settings page.

Screen.Recording.2024-06-17.at.14.21.44.mov

How to test

  • Go to Cases > Settings

  • Add a template

  • Click on edit template icon

  • Update the fields

  • Click save

  • Click on delete template icon

  • Click on confirm modal

  • Click save

Scenarios:

  • Edit template with different custom fields
  • Edit template with connector
  • Delete template

Flaky Test here

Checklist

@js-jankisalvi js-jankisalvi added release_note:skip Skip the PR/issue when compiling release notes Team:ResponseOps Label for the ResponseOps team (formerly the Cases and Alerting teams) Feature:Cases Cases feature v8.15.0 labels Jun 10, 2024
@js-jankisalvi js-jankisalvi self-assigned this Jun 10, 2024
@js-jankisalvi
Copy link
Contributor Author

/ci

@js-jankisalvi
Copy link
Contributor Author

/ci

@js-jankisalvi js-jankisalvi marked this pull request as ready for review June 17, 2024 13:32
@js-jankisalvi js-jankisalvi requested a review from a team as a code owner June 17, 2024 13:32
@elasticmachine
Copy link
Contributor

Pinging @elastic/response-ops (Team:ResponseOps)

@elasticmachine
Copy link
Contributor

Pinging @elastic/response-ops-cases (Feature:Cases)

(allIncidentTypes ?? []).find((type) => incidentType === type.id.toString())?.name ??
'',
}));
const selectedOptions =
Copy link
Contributor Author

@js-jankisalvi js-jankisalvi Jun 17, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Made this change to fix this weird behaviour in UI

image

@kibanamachine
Copy link
Contributor

Flaky Test Runner Stats

🟠 Some tests failed. - kibana-flaky-test-suite-runner#6331

[✅] x-pack/test/functional_with_es_ssl/apps/cases/group2/config.ts: 25/25 tests passed.
[❌] x-pack/test_serverless/functional/test_suites/observability/config.ts: 0/25 tests passed.
[❌] x-pack/test_serverless/functional/test_suites/security/config.ts: 24/25 tests passed.

see run history

Copy link
Contributor

@doakalexi doakalexi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tested locally and works expected. I was able to edit and delete templates. LGTM!

Copy link
Member

@cnasikas cnasikas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! I tested and I found the following bugs

  1. I cannot remove the parent from Jira
Screen.Recording.2024-06-18.at.3.21.42.PM.mov
  1. The first category on SecOps is selected but the subcategories are not shown
Screen.Recording.2024-06-18.at.3.46.59.PM.mov
  1. When changing connectors the fields are not resetted
Screen.Recording.2024-06-18.at.3.23.10.PM.mov

Also, the size of the component in x-pack/plugins/cases/public/components/configure_cases/index.tsx it grows a lot and I get the following warning. Maybe we can fix it on another PR.

Screenshot 2024-06-19 at 11 21 33 AM

In my PR I change the way the connectors are being handled. Bugs 2 and 3 will be fixed there.

x-pack/plugins/cases/public/components/templates/utils.ts Outdated Show resolved Hide resolved
return await testSubjects.exists('templates-list');
});

expect(await testSubjects.getVisibleText('templates-list')).to.be(
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: Should we verify the rest of the updated fields?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I will create a separate PR to create connector and custom field utils for e2e tests.

@cnasikas cnasikas added Feature:Cases Cases feature and removed Feature:Cases Cases feature labels Jun 19, 2024
@js-jankisalvi
Copy link
Contributor Author

  1. I cannot remove the parent from Jira

Fixed here

@js-jankisalvi
Copy link
Contributor Author

@elasticmachine merge upstream

@kibana-ci
Copy link
Collaborator

kibana-ci commented Jun 19, 2024

💔 Build Failed

Failed CI Steps

Test Failures

  • [job] [logs] FTR Configs #62 / ML app anomaly detection alert overview page alert flyout controls can create an anomaly detection alert
  • [job] [logs] FTR Configs #62 / ML app anomaly detection alert overview page alert flyout controls can create an anomaly detection alert
  • [job] [logs] Jest Tests #13 / UserCommentPropertyActions renders the correct number of actions

Metrics [docs]

‼️ ERROR: no builds found for mergeBase sha [f975c33]

History

To update your PR or re-run it, just comment with:
@elasticmachine merge upstream

cc @js-jankisalvi

@js-jankisalvi js-jankisalvi merged commit c3b0759 into elastic:feat/case_templates Jun 19, 2024
20 of 23 checks passed
@js-jankisalvi js-jankisalvi deleted the edit-delete-template branch June 19, 2024 23:58
@kibanamachine
Copy link
Contributor

Flaky Test Runner Stats

🟠 Some tests failed. - kibana-flaky-test-suite-runner#6360

[❌] x-pack/test/functional_with_es_ssl/apps/cases/group2/config.ts: 11/25 tests passed.
[❌] x-pack/test_serverless/functional/test_suites/observability/config.ts: 14/25 tests passed.
[✅] x-pack/test_serverless/functional/test_suites/security/config.ts: 25/25 tests passed.

see run history

cnasikas added a commit that referenced this pull request Jun 28, 2024
## Summary

This PR adds the ability for users to select a template when creating a
case. When a user selects a template the cases form fields are populated
with the values from the template. The solution picker in the flyout
changed as:

<img width="1281" alt="Screenshot 2024-06-20 at 1 26 14 PM"
src="https://github.com/elastic/kibana/assets/7871006/30859c61-94e7-4f0a-97d1-cb081bd72c36">

## Bug fixes

1. Changing the solution through the solution picket in the flyout would
not respect the connector's configuration.
2. Bug where the lazy loading of connectors' icons was causing the
flyout to open and close when you selected a solution picket. This bug
appeared when the first bug was fixed.

## Testing

1. Go to all solutions and create cases setting all fields (including
all fields of all supported connectors) without using templates. Verify
that everything is working as expected.
2. Go to all solutions, create different templates on each solution, and
verify that when creating a case you can use templates and everything is
working as expected.
3. Go to the alerts table of o11y and security and attach alerts to a
new case. Verify that in the flyout the templates are working as
expected.
4. Go to ML and try to attach an ML visualization to a new case. Verify
that the solution picker is working as expected and it resets the form
when changing solutions.

Fixes: #181871
Depends on: #185877

### Checklist

Delete any items that are not applicable to this PR.

- [x] [Unit or functional
tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)
were updated or added to match the most common scenarios
- [ ] [Flaky Test
Runner](https://ci-stats.kibana.dev/trigger_flaky_test_runner/1) was
used on any tests changed

### For maintainers

- [x] This was checked for breaking API changes and was [labeled
appropriately](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)

---------

Co-authored-by: Janki Salvi <[email protected]>
Co-authored-by: adcoelho <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Feature:Cases Cases feature release_note:skip Skip the PR/issue when compiling release notes Team:ResponseOps Label for the ResponseOps team (formerly the Cases and Alerting teams) v8.15.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants