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 #167651

Closed
cnasikas opened this issue Sep 29, 2023 · 0 comments · Fixed by #172276
Closed

[Cases] Cases table: Configure available filters including custom fields #167651

cnasikas opened this issue Sep 29, 2023 · 0 comments · Fixed by #172276
Assignees
Labels
Feature:Cases Cases feature Team:ResponseOps Label for the ResponseOps team (formerly the Cases and Alerting teams)

Comments

@cnasikas
Copy link
Member

cnasikas commented Sep 29, 2023

Summary

We need to let users to be able to filter based on custom fields. Given that the number of fields can be big we should offer the ability to users to configure their desired filters in the existing cases table.

Screenshot 2023-09-29 at 5 24 38 PM Screenshot 2023-09-29 at 5 32 04 PM

DoD

  • Users should be able to filter by custom fields using the APIs
  • Users should be able to select/deselect their filters including custom fields
  • Existing functionality for persistent filters to the local storage should be extended to support the custom fields
  • Existing functionality for persistent filters to the URL should be extended to support the custom fields
  • Pasting a URL with filters should select and show the corresponding filters

For custom fields filtering it depends on: #167740

@cnasikas cnasikas changed the title Cases table: Toggle filters including custom fields [Cases] Cases table: Toggle filters including custom fields Sep 29, 2023
@cnasikas cnasikas added Team:ResponseOps Label for the ResponseOps team (formerly the Cases and Alerting teams) Feature:Cases Cases feature labels Sep 29, 2023
@cnasikas cnasikas changed the title [Cases] Cases table: Toggle filters including custom fields [Cases] Cases table: Configure available filters including custom fields Oct 5, 2023
jcger added a commit that referenced this issue Oct 30, 2023
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 <[email protected]>
Co-authored-by: kibanamachine <[email protected]>
jcger added a commit that referenced this issue Nov 8, 2023
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 <[email protected]>
Co-authored-by: Antonio <[email protected]>
jcger added a commit that referenced this issue Nov 9, 2023
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`
jcger added a commit that referenced this issue Nov 14, 2023
…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
jcger added a commit that referenced this issue Nov 30, 2023
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 <[email protected]>
jcger added a commit that referenced this issue Dec 4, 2023
…lds (#172276)

Meta issue #167651
Fixes: #167651

## Summary
Previous PRs merged into this feature branch:
- #169356
- #169371
- #170851
- #171102
- #171176

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

## Pending issues
- Table in modal shouldn’t load in local storage saved filter options of
status/severity
- Status & Severity filters in url. Filters must be activated if the
user has them deactivated
- UI overflow when to much filters are active
- Race condition: When a user has a custom field active with an option
selected and this custom field gets removed in settings, it includes the
removed custom field when refreshing. This request will fail, triggering
a second one which won't include the removed custom field
- Found during QA. In the modal, when trying to select all options in
the solutions filter, when checking the last unchecked option, it resets
and there is no checked option anymore

## Flaky test runner link

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

---------

Co-authored-by: Antonio <[email protected]>
Co-authored-by: kibanamachine <[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 Team:ResponseOps Label for the ResponseOps team (formerly the Cases and Alerting teams)
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants