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] Cases Table: Configure Available Filters Including Custom Fields #172276

Merged
merged 19 commits into from Dec 4, 2023

Conversation

jcger
Copy link
Contributor

@jcger jcger commented Nov 30, 2023

Meta issue #167651
Fixes: #167651

Summary

Previous PRs merged into this feature branch:

Release notes

Case list filter bar can now be customised. Filters can be removed and custom fields can be used as filters

Pending issues

Flaky test runner link

https://buildkite.com/elastic/kibana-flaky-test-suite-runner/builds/4128

jcger and others added 14 commits October 30, 2023 09:47
Meta #167651

### Description
Part 1/3. This PR brings no updates to the UI but refactors the `status`
and `severity` filters to allow multi selection.

### QA
- Filters should work the same as before
- But in the local storage, status and severity filters are now stored
as an array instead of a string (be aware that current users will have
status and severity stored as strings the first time they enter the case
list page)
- _find API should throw no error when status or severity have more than
one value

#### Example: Status in-progress or open, severity medium or low
<pre>
curl --location
'http://localhost:5601/api/cases/_find?owner=observability&sortField=title&sortOrder=desc&status=in-progress&status=open&severity=medium&severity=low'
\
--header 'kbn-xsrf: true' \
--header 'Authorization: Basic ZWxhc3RpYzpjaGFuZ2VtZQ=='
</pre>

---------

Co-authored-by: Antonio <antoniodcoelho@gmail.com>
Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
Meta #167651

### Description
Part 2/3. This PR refactors the filters to be multi select

<img width="829" alt="Screenshot"
src="https://github.com/elastic/kibana/assets/17549662/5b0efe3f-f4a0-423e-9d64-0dfa50e74ce6">

### QA
- Filters work as multi select now
- 'All' has been removed as option for status and severity. Check that
old urls, local storage values do not break anything
- Review the cases list in the modal when adding a timeline to a case

---------

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
Co-authored-by: Antonio <antoniodcoelho@gmail.com>
Meta #167651

Refactors the Solution Filter to use the same component as the rest of
the filters


![Screenshot](https://github.com/elastic/kibana/assets/17549662/df506f77-edb8-4fd7-ae2f-cb6b04b7ff29)


## QA

Add `Sample web logs` data and click on `View Data` > `ML Jobs`

![Screenshot](https://github.com/elastic/kibana/assets/17549662/8540be39-45bb-4307-a4a6-bbeef382f0aa)

Then on the `3 dots right side` of the `Anomaly timeline` > `Add to
case` > `Overall`
…171102)

Meta issue: #167651

## Summary
We need to make a small update to our multi select component. Right now,
it only allows options with labels, but for custom fields, we might have
situations where different fields have the same label. So, we're going
to adjust it to work with options that have both {key, label}.

For our system filters (status, category, severity, ...) we'll keep
using the label as the key. This is important because it helps us
maintain our current way of handling the global state of our filters
without any issues

## QA
An exhaustive QA is not required for this PR, as it's only going into a
feature branch. The filters should continue working
Meta issue: #167651

## Summary


https://github.com/elastic/kibana/assets/17549662/b0fc9464-8cac-4547-8a85-aac24cf941e9

## What this PR does not include (will be done in future PRs)
- If the users adds to many filters, the UI will overflow
- If the url contains status or severity set and the filter is not
active, we need to automatically activate that filter and set the filter
option

## useEffect situation

We tried to remove some useEffects, specifically in
[useFilterConfig](https://github.com/elastic/kibana/pull/171176/files#diff-3e3d844f888b4030bd3f3ead9e71866757a6d9ff7e5d3972afebed9956fcddceR62)
and
[useSystemFilterConfig](https://github.com/elastic/kibana/pull/171176/files#diff-2696d6c860ec0b34363c060d2638f2b63698f06128d1155f735f34de7cc5b5b3R200)
but as they have dependencies that are loaded from API's, there are some
use cases, like if a new custom field is added or removed where effects
(I think) are a must. We will come back to this issue once we have the
feature in main to try to solve this issue

---------

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
@jcger jcger added Team:ResponseOps Label for the ResponseOps team (formerly the Cases and Alerting teams) Feature:Cases Cases feature release_note:feature Makes this part of the condensed release notes v8.12.0 labels Nov 30, 2023
@jcger jcger marked this pull request as ready for review December 1, 2023 08:03
@jcger jcger requested review from a team as code owners December 1, 2023 08:03
@elasticmachine
Copy link
Contributor

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

@elasticmachine
Copy link
Contributor

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

Copy link
Contributor

@semd semd left a comment

Choose a reason for hiding this comment

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

Security code LGTM

@kibana-ci
Copy link
Collaborator

💛 Build succeeded, but was flaky

Failed CI Steps

Metrics [docs]

Module Count

Fewer modules leads to a faster build time

id before after diff
cases 705 712 +7

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
cases 95 94 -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 448.4KB 442.0KB -6.4KB

Public APIs missing exports

Total count of every type that is part of your API that should be exported but is not. This will cause broken links in the API documentation system. Target amount is 0. Run node scripts/build_api_docs --plugin [yourplugin] --stats exports for more detailed information.

id before after diff
cases 28 27 -1

Page load bundle

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

id before after diff
cases 156.6KB 167.9KB +11.3KB
Unknown metric groups

API count

id before after diff
cases 115 114 -1

ESLint disabled line counts

id before after diff
cases 56 57 +1

Total ESLint disabled count

id before after diff
cases 72 73 +1

History

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

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.

I tested and everything is working as expected (including migrating from main to your branch) except the ones in the description. I found a small bug. In the solution filter if you try to click all of the options you cannot click a third filter. It does not matter which one.

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.

Amazing work 🚀 🎉
I tested below scenarios and they are working as expected:

  • Multiple filter selection including custom fields
  • filter config behaviour in URL and local storage
  • Having old values in the local storage
  • active filter behaviour in URL and local storage
  • Selector view - found same bug as Christos mentioned regarding the solution filter

Found small UI issue:

When customField label is too long or there are more number of custom fields selected in the filter config, the more button is not accessible.
Maybe we can move only more button in next line in this case?

image

@jcger
Copy link
Contributor Author

jcger commented Dec 4, 2023

Found small UI issue:

When customField label is too long or there are more number of custom fields selected in the filter config, the more button is not accessible. Maybe we can move only more button in next line in this case?

Thanks Janki, we will fix it when fixing the overflow issue. Don't know yet how to solve it.

@jcger jcger merged commit 90d6358 into main Dec 4, 2023
37 checks passed
@jcger jcger deleted the cases/167651 branch December 4, 2023 10:47
@kibanamachine kibanamachine added the backport:skip This commit does not require backporting label Dec 4, 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 Feature:Cases Cases feature release_note:feature Makes this part of the condensed release notes Team:ResponseOps Label for the ResponseOps team (formerly the Cases and Alerting teams) v8.12.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Cases] Cases table: Configure available filters including custom fields
7 participants