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] Category fixes #160026

Merged
merged 8 commits into from
Jun 21, 2023
Merged

[Cases] Category fixes #160026

merged 8 commits into from
Jun 21, 2023

Conversation

cnasikas
Copy link
Member

@cnasikas cnasikas commented Jun 20, 2023

Summary

This PR:

  • Fixes a bug with the category sorting
  • Fixes a bug where the save button is not disabled on error or no changes
  • Fixes a bug where case-sensitive categories cannot be added
  • Fixes a bug where if the category change from another user the form does not reflect the change
  • Fixes a UX bug where it is difficult to understand how to remove a category
  • Add more tests

Checklist

Delete any items that are not applicable to this PR.

For maintainers

@cnasikas cnasikas added bug Fixes for quality problems that affect the customer experience Team:ResponseOps Label for the ResponseOps team (formerly the Cases and Alerting teams) Feature:Cases Cases feature v8.9.0 labels Jun 20, 2023
@cnasikas cnasikas self-assigned this Jun 20, 2023
@cnasikas cnasikas added the release_note:skip Skip the PR/issue when compiling release notes label Jun 20, 2023
@cnasikas cnasikas marked this pull request as ready for review June 20, 2023 15:37
@cnasikas cnasikas requested a review from a team as a code owner June 20, 2023 15:37
@elasticmachine
Copy link
Contributor

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

@elasticmachine
Copy link
Contributor

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

@@ -258,7 +258,6 @@ export const CasesFindRequestRt = rt.exact(
/**
* The field to use for sorting the found objects.
*
Copy link
Contributor

Choose a reason for hiding this comment

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

would be nice to have somewhere documenting which fields are supported though

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, we can do it when we apply the limits in 8.10. The types will give us the supported fields.

@@ -72,6 +72,10 @@ describe('validators', () => {
it('returns true if the category is an empty string', () => {
expect(isCategoryFieldInvalidString('')).toBe(true);
});

it('returns true if the string contains only spaces', () => {
expect(isCategoryFieldInvalidString(' ')).toBe(true);
Copy link
Contributor

Choose a reason for hiding this comment

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

thanks 😁

expect(screen.getByTestId('edit-category-submit')).toBeDisabled();
});

it('should disabled the save button on when not changing category', async () => {
Copy link
Contributor

Choose a reason for hiding this comment

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

nit:

Suggested change
it('should disabled the save button on when not changing category', async () => {
it('should disabled the save button when not changing category', async () => {

@@ -438,6 +438,26 @@ describe('Cases API', () => {
});
expect(resp).toEqual({ ...allCases });
});

it('should not send the category field if it an empty array', async () => {
Copy link
Contributor

Choose a reason for hiding this comment

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

nit:

Suggested change
it('should not send the category field if it an empty array', async () => {
it('should not send the category field if it is an empty array', async () => {

@@ -456,13 +456,23 @@ export const getCaseToUpdate = (
{ id: queryCase.id, version: queryCase.version }
);

/**
Copy link
Contributor

Choose a reason for hiding this comment

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

Is there an issue for this?

Copy link
Member Author

@cnasikas cnasikas Jun 21, 2023

Choose a reason for hiding this comment

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

Yes, #153726 section "Strict input validation". We will address it there including the unification of the backend & the frontend.

Copy link
Contributor

@jonathan-buttner jonathan-buttner left a comment

Choose a reason for hiding this comment

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

Looks good. Would there be an easy way to allow deselecting a category to "unset" it? That was a little confusing to me because the only way to "unset" it that worked was do hit the backspace/delete

@cnasikas
Copy link
Member Author

Looks good. Would there be an easy way to allow deselecting a category to "unset" it? That was a little confusing to me because the only way to "unset" it that worked was do hit the backspace/delete

Oh, I see what you mean. I added the following:

Screenshot 2023-06-21 at 10 28 27 AM

Same pattern as with assignees.

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.

Tested the new "delete category" button, I like it!

Leaving the approval for the rest which I had already reviewed and tested 👍

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 all bugs locally, works as expected!! 👍
Nice work 👏

it('renders the status column', async () => {
appMockRenderer.render(<AllCasesList />);

expect(screen.getByTestId('tableHeaderCell_status_8')).toBeInTheDocument();
Copy link
Contributor

Choose a reason for hiding this comment

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

Thanks for doing this 😄

Copy link
Contributor

Choose a reason for hiding this comment

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

+1 :D

@cnasikas cnasikas enabled auto-merge (squash) June 21, 2023 09:12
@kibana-ci
Copy link
Collaborator

💚 Build Succeeded

Metrics [docs]

Module Count

Fewer modules leads to a faster build time

id before after diff
cases 652 653 +1

Async chunks

Total size of all lazy-loaded chunks that will be downloaded as the user navigates the app

id before after diff
cases 421.8KB 422.7KB +926.0B

Page load bundle

Size of the bundles that are downloaded on every page load. Target size is below 100kb

id before after diff
cases 141.0KB 141.0KB +11.0B
Unknown metric groups

ESLint disabled in files

id before after diff
cases 17 18 +1

ESLint disabled line counts

id before after diff
enterpriseSearch 13 15 +2
securitySolution 411 415 +4
total +6

Total ESLint disabled count

id before after diff
cases 75 76 +1
enterpriseSearch 14 16 +2
securitySolution 494 498 +4
total +7

History

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

cc @cnasikas

@cnasikas cnasikas merged commit 834298c into elastic:main Jun 21, 2023
@cnasikas cnasikas deleted the category_fixes branch June 21, 2023 11:08
@kibanamachine kibanamachine added the backport:skip This commit does not require backporting label Jun 21, 2023
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 bug Fixes for quality problems that affect the customer experience 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.9.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants