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

[Cases] Case action enhancements and fixes #180758

Merged
merged 14 commits into from
Apr 16, 2024
Merged

Conversation

cnasikas
Copy link
Member

@cnasikas cnasikas commented Apr 13, 2024

Summary

In this PR:

  • Address @adcoelho comments regarding documentation.
  • Fix @js-jankisalvi bug about unsupported consumers ([Cases] Case action #168369 (review)).
  • Address @shanisagiv1 feedback regarding the title and the description. Specifically:
    • The title changed to "<rule_name> - Grouping by <grouping_by_value> (Auto-created)".
    • The description changed to "This case was created by the Case action in <rule_name_link>. The assigned alerts are grouped by <grouping_by_key>:<grouping_by_value>".
  • Add the grouping key as a tag.
Screenshot 2024-04-13 at 4 41 36 PM

The issue about the "Unknown" user will be fixed in another PR.

About @adcoelho bug:

rule_grouping_UI_issue.mov

I think it is fine to leave it as it is because a) the value will not be saved even if they are added b) an error is being shown c) the only way to do it properly is to validate while the user is typing which is going to lead to bad UX. If you feel otherwise let me know.

Checklist

Delete any items that are not applicable to this PR.

For maintainers

@cnasikas cnasikas 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.14.0 labels Apr 13, 2024
@cnasikas cnasikas self-assigned this Apr 13, 2024
@cnasikas
Copy link
Member Author

/ci

@cnasikas cnasikas marked this pull request as ready for review April 15, 2024 08:36
@cnasikas cnasikas requested a review from a team as a code owner April 15, 2024 08:36
@elasticmachine
Copy link
Contributor

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

@elasticmachine
Copy link
Contributor

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

.map(([key, value]) => {
const keyAsCodeBlock = `\`${key}\``;
const valueAsCodeBlock = `\`${convertValueToString(value)}\``;
const description = `This case was created by the Case action in ${ruleName}.`;
Copy link
Contributor

Choose a reason for hiding this comment

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

What if we find a way to highlight/differentiate the rule name? Maybe by wrapping it in quotation marks or having it in italics?

I think currently it looks a bit messy:
Screenshot 2024-04-15 at 10 44 35

Copy link
Member Author

Choose a reason for hiding this comment

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

Good point. If you see my screenshot in the description if you have set the server.publicBaseUrl: 'https://localhost:5601' in your kibana.dev.yml the name of the rule would be a URL. Quotation marks seem more suitable with links. Wdyt?

Copy link
Contributor

Choose a reason for hiding this comment

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

Ah I like how it looks in the screenshot, imo that is ideal and we dont need the quotation marks.

Is there any scenario where no URL is rendered and we just have the name?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes if the user is not set server.publicBaseUrl it will be shown as in your screenshot.

Copy link
Contributor

@adcoelho adcoelho 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 the changes and the fixes work.

I left one small comment about the Case description.

Regarding the bug I found previously you mention the following in this PR's Summary:

the only way to do it properly is to validate while the user is typing which is going to lead to bad UX

Why only during typing? We already have an error being shown, can't we prevent the user from clicking Save if the form has errors?

I tried other fields and saving is not allowed if they have errors. This behavior is not consistent with the rest of the sidepanel.

Screen.Recording.2024-04-15.at.10.57.49.mov

Copy link
Contributor

@js-jankisalvi js-jankisalvi left a comment

Choose a reason for hiding this comment

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

Verified again and it works as expected. 👍

We already have an error being shown, can't we prevent the user from clicking Save if the form has errors?

Agree with @adcoelho We prevent to save when there is an error. We should keep similar behaviour for group by alert field.

const ruleNameTrimmed = ruleName.slice(0, MAX_TITLE_LENGTH - suffix.length - 1);
const suffix = `${
groupingDescription.length > 0 ? ` - Grouping by ${groupingDescription}` : ''
}${oracleCounter > INITIAL_ORACLE_RECORD_COUNTER ? ` (${oracleCounter})` : ''} (Auto-created)`;
Copy link
Contributor

Choose a reason for hiding this comment

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

Should (Auto-created) be translated? What about the description or the grouping description?

Copy link
Member Author

@cnasikas cnasikas Apr 15, 2024

Choose a reason for hiding this comment

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

Hey! I do not think we should translate them because this content is generated dynamically on the server side. It is not a static text on the UI.

Copy link
Contributor

Choose a reason for hiding this comment

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

ok but if I might nitpick a bit, I think we should answer another question. Should the user be seeing it in their default set language or in english? I disagree that depending where it comes from it should be translated or not. IMO it's better UX.

Copy link
Member Author

Choose a reason for hiding this comment

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

To be honest, I am not sure what is the best practice here and what we do in Kibana. @lcawl what we should do here?

Copy link
Contributor

Choose a reason for hiding this comment

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

I'm not sure if either of these links are helpful: https://eui.elastic.co/#/utilities/i18n or https://github.com/elastic/kibana/tree/main/packages/kbn-i18n. However I agree that we should try to translate these phrases if it's possible.

Copy link
Member Author

Choose a reason for hiding this comment

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

return `${description} The assigned alerts are grouped by ${groupingDescription}.`;
}

return `${description}`;
Copy link
Contributor

Choose a reason for hiding this comment

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

shouldn't this be just return description?

Copy link
Member Author

Choose a reason for hiding this comment

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

@cnasikas
Copy link
Member Author

@adcoelho @js-jankisalvi We can only disable the Save button if the groupingBy field changes and the validation runs. In this scenario, the onChange callback is not called by the EuiCombobox so the field does not change and the validation will not run. I think it is an issue with how the actions UI framework works. The only functions that give us what the user types is onSearch or onKeyDown. They are fired on every keystroke typed by the user. If we change the value as the user types, so we can run the validation, we can run into weird performance issues and bugs. The work on the new rule form would probably fix this. I cannot find a way to do it properly. Any suggestions/alternatives I can use? cc @Zacqary

@cnasikas cnasikas enabled auto-merge (squash) April 16, 2024 10:13
@kibana-ci
Copy link
Collaborator

💚 Build Succeeded

Metrics [docs]

Public APIs missing comments

Total count of every public API that lacks a comment. Target amount is 0. Run node scripts/build_api_docs --plugin [yourplugin] --stats comments for more detailed information.

id before after diff
alerting 825 826 +1
Unknown metric groups

API count

id before after diff
alerting 857 858 +1

History

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

cc @cnasikas

@cnasikas cnasikas merged commit e9266f3 into elastic:main Apr 16, 2024
36 checks passed
@cnasikas cnasikas deleted the ca_fixes branch April 16, 2024 12:10
@kibanamachine kibanamachine added the backport:skip This commit does not require backporting label Apr 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport:skip This commit does not require backporting 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.14.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants