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

[Security Solution][Alerts] saved query UX improvements #140064

Merged
merged 82 commits into from
Sep 18, 2022

Conversation

vitaliidm
Copy link
Contributor

@vitaliidm vitaliidm commented Sep 6, 2022

Summary

  • addresses [Security Solution][Alerts] Saved query rule type UX improvements #139250
  • adds checkbox Load the saved query dynamically on each rule execution for query and saved_query rule types on create/edit form if saved query selected. When checkbox checked, updates, made by user, to filters and query input will be dismissed. Filters and input will become disabled, to prevent further changes in controls. On saving, rule would be saved as saved_query type.
  • create unified query/saved_query schema, against which rules would be validated. That would allow to save query rule as saved_query and vice verse
  • shows on rule details page saved query name and loads its filters and query, so these values shown to users, will always be up to date with the saved query

Screenshots and video

Screenshot 2022-09-07 at 18 21 59

Screen.Recording.2022-09-13.at.14.31.20.mov

Checklist

Delete any items that are not applicable to this PR.

@@ -27,6 +27,7 @@ export interface Props {
* Applies extra styles necessary when coupled with the query bar
*/
afterQueryBar?: boolean;
readOnly?: boolean;
Copy link
Contributor Author

Choose a reason for hiding this comment

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

changes for unified_search components will be removed after #140101 is merged, and present here only for demo/POC purposes

@peluja1012 peluja1012 enabled auto-merge (squash) September 15, 2022 17:04
@kibanamachine kibanamachine requested a review from a team as a code owner September 15, 2022 17:07
@botelastic botelastic bot added the Team:Fleet Team label for Observability Data Collection Fleet team label Sep 15, 2022
@elasticmachine
Copy link
Contributor

Pinging @elastic/fleet (Team:Fleet)

@vitaliidm vitaliidm removed the request for review from a team September 15, 2022 17:25
Copy link
Contributor

@banderror banderror left a comment

Choose a reason for hiding this comment

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

Great functional enhancement, thanks @vitaliidm!

I reviewed some of the changes on the FE side and left a few comments. I didn't test the PR. I would be happy if you could address the feedback after the FF.

@marshallmain There's a merge conflict that I tried to resolve but wasn't able to push to Vitalii's branch (weird because I used to do it previously with some PRs). UPD: was able to resolve it via GitHub's UI :)

@@ -9,6 +9,7 @@ import { APP_UI_ID } from '../../../../common/constants';
export const REQUEST_NAMES = {
SECURITY_DASHBOARDS: `${APP_UI_ID} fetch security dashboards`,
ANOMALIES_TABLE: `${APP_UI_ID} fetch anomalies table data`,
GET_SAVED_QUERY: `${APP_UI_ID} fetch saved query`,
Copy link
Contributor

Choose a reason for hiding this comment

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

@semd why useFetch doesn't accept a string as a request name? Each time we need to implement a new request we will have to modify this file which doesn't respect the open-closed principle.

Comment on lines +20 to +23
const { fetch, data, isLoading, error } = useFetch(
REQUEST_NAMES.GET_SAVED_QUERY,
savedQueryServices.getSavedQuery
);
Copy link
Contributor

Choose a reason for hiding this comment

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

@vitaliidm We started migrating our client-side data fetching logic to react-query. What are the benefits of using useFetch for this particular API call compared to react-query?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

it uses under the hood in https://github.com/elastic/kibana/blob/main/x-pack/plugins/security_solution/public/common/utils/saved_query_services/index.tsx

createSavedQueryService from @kbn/data-plugin/public.

If we would like to use useFetch, we need to extract urls from data plugin and implement it on our side

@kibana-ci
Copy link
Collaborator

💛 Build succeeded, but was flaky

Failed CI Steps

Test Failures

  • [job] [logs] Security Solution Tests #4 / url state sets and reads the url state for timeline by id

Metrics [docs]

Module Count

Fewer modules leads to a faster build time

id before after diff
securitySolution 3075 3076 +1

Async chunks

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

id before after diff
securitySolution 6.4MB 6.4MB +7.9KB

History

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

cc @vitaliidm

@peluja1012 peluja1012 merged commit ffd41ef into elastic:main Sep 18, 2022
@kibanamachine kibanamachine added the backport:skip This commit does not require backporting label Sep 18, 2022
vitaliidm added a commit that referenced this pull request Sep 27, 2022
## Summary
addresses feedback left during code review for #140064

- Saved query checkbox label shows saved query name
- `createSavedQuery` moved to `x-pack/plugins/security_solution/cypress/tasks/api_calls/saved_queries.ts`
- `useGetSavedQuery` moved to `x-pack/plugins/security_solution/public/detections/pages/detection_engine/rules/details`
- additional comments and minor code changes

### Before
<img width="762" alt="Screenshot 2022-09-26 at 11 38 05" src="https://user-images.githubusercontent.com/92328789/192256482-2bfc29c9-305a-4ff6-b9cd-b0505e887bd1.png">

### After
<img width="989" alt="Screenshot 2022-09-26 at 11 37 23" src="https://user-images.githubusercontent.com/92328789/192256378-290183b1-44e2-47bb-9d64-c46d0819cff4.png">
kibanamachine pushed a commit to kibanamachine/kibana that referenced this pull request Sep 27, 2022
…#141747)

## Summary
addresses feedback left during code review for elastic#140064

- Saved query checkbox label shows saved query name
- `createSavedQuery` moved to `x-pack/plugins/security_solution/cypress/tasks/api_calls/saved_queries.ts`
- `useGetSavedQuery` moved to `x-pack/plugins/security_solution/public/detections/pages/detection_engine/rules/details`
- additional comments and minor code changes

### Before
<img width="762" alt="Screenshot 2022-09-26 at 11 38 05" src="https://user-images.githubusercontent.com/92328789/192256482-2bfc29c9-305a-4ff6-b9cd-b0505e887bd1.png">

### After
<img width="989" alt="Screenshot 2022-09-26 at 11 37 23" src="https://user-images.githubusercontent.com/92328789/192256378-290183b1-44e2-47bb-9d64-c46d0819cff4.png">

(cherry picked from commit f585dd6)
kibanamachine added a commit that referenced this pull request Sep 27, 2022
#141962)

## Summary
addresses feedback left during code review for #140064

- Saved query checkbox label shows saved query name
- `createSavedQuery` moved to `x-pack/plugins/security_solution/cypress/tasks/api_calls/saved_queries.ts`
- `useGetSavedQuery` moved to `x-pack/plugins/security_solution/public/detections/pages/detection_engine/rules/details`
- additional comments and minor code changes

### Before
<img width="762" alt="Screenshot 2022-09-26 at 11 38 05" src="https://user-images.githubusercontent.com/92328789/192256482-2bfc29c9-305a-4ff6-b9cd-b0505e887bd1.png">

### After
<img width="989" alt="Screenshot 2022-09-26 at 11 37 23" src="https://user-images.githubusercontent.com/92328789/192256378-290183b1-44e2-47bb-9d64-c46d0819cff4.png">

(cherry picked from commit f585dd6)

Co-authored-by: Vitalii Dmyterko <92328789+vitaliidm@users.noreply.github.com>
jennypavlova pushed a commit to jennypavlova/kibana that referenced this pull request Sep 27, 2022
…#141747)

## Summary
addresses feedback left during code review for elastic#140064

- Saved query checkbox label shows saved query name
- `createSavedQuery` moved to `x-pack/plugins/security_solution/cypress/tasks/api_calls/saved_queries.ts`
- `useGetSavedQuery` moved to `x-pack/plugins/security_solution/public/detections/pages/detection_engine/rules/details`
- additional comments and minor code changes

### Before
<img width="762" alt="Screenshot 2022-09-26 at 11 38 05" src="https://user-images.githubusercontent.com/92328789/192256482-2bfc29c9-305a-4ff6-b9cd-b0505e887bd1.png">

### After
<img width="989" alt="Screenshot 2022-09-26 at 11 37 23" src="https://user-images.githubusercontent.com/92328789/192256378-290183b1-44e2-47bb-9d64-c46d0819cff4.png">
@vitaliidm vitaliidm deleted the detections/saved-query-ux branch March 4, 2024 17:31
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 enhancement New value added to drive a business result release_note:enhancement Team:Detection Alerts Security Detection Alerts Area Team Team:Detections and Resp Security Detection Response Team Team:Fleet Team label for Observability Data Collection Fleet team Team: SecuritySolution Security Solutions Team working on SIEM, Endpoint, Timeline, Resolver, etc. v8.5.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants