-
Notifications
You must be signed in to change notification settings - Fork 8.2k
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
[Security Solution][Alerts] saved query UX improvements #140064
Conversation
x-pack/plugins/security_solution/public/detections/components/rules/query_bar/index.tsx
Outdated
Show resolved
Hide resolved
…rules/query_bar/index.tsx
@@ -27,6 +27,7 @@ export interface Props { | |||
* Applies extra styles necessary when coupled with the query bar | |||
*/ | |||
afterQueryBar?: boolean; | |||
readOnly?: boolean; |
There was a problem hiding this comment.
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
…-ref HEAD~1..HEAD --fix'
Pinging @elastic/fleet (Team:Fleet) |
There was a problem hiding this 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 :)
x-pack/plugins/security_solution/public/common/hooks/use_get_saved_query.ts
Show resolved
Hide resolved
@@ -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`, |
There was a problem hiding this comment.
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.
const { fetch, data, isLoading, error } = useFetch( | ||
REQUEST_NAMES.GET_SAVED_QUERY, | ||
savedQueryServices.getSavedQuery | ||
); |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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
x-pack/plugins/security_solution/public/detections/components/rules/query_bar/index.tsx
Show resolved
Hide resolved
...k/plugins/security_solution/public/detections/pages/detection_engine/rules/details/index.tsx
Show resolved
Hide resolved
💛 Build succeeded, but was flaky
Failed CI StepsTest FailuresMetrics [docs]Module Count
Async chunks
History
To update your PR or re-run it, just comment with: cc @vitaliidm |
## 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">
…#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)
#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>
…#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">
Summary
Screenshots and video
Screen.Recording.2022-09-13.at.14.31.20.mov
Checklist
Delete any items that are not applicable to this PR.