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

[SecuritySolution] Setup dashboard view page #153040

Merged
merged 34 commits into from
Apr 11, 2023

Conversation

angorayc
Copy link
Contributor

@angorayc angorayc commented Mar 9, 2023

Summary

#152955

Demo link: https://kibana-pr-154806.kb.us-west2.gcp.elastic-cloud.com:9243/
https://p.elstc.co/paste/vPoSt7eC#txCuL6KJWRCPRJ0ae4minlT7IgGBJ5F8MTloWIOVQcw

This create a single dashboard view under Security Solution:

  • Add dashboard view path: /app/security/dashboards/:dashboardId
  • Move the dashboards landing page to this new sub-plugin.
  • Check users' read permission to render a dashboard.
  • Render a dashboard with the given saved object id.
  • Show the dashboard name in the breadcrumbs.

Dashboard not found:

Screenshot 2023-03-23 at 13 44 01

Dashboard rendered:

Screenshot 2023-03-23 at 13 44 28

Interact with filters and query:

Screen.Recording.2023-03-23.at.13.47.06.mov

Interact with Open in Lens and Investigate in timeline

Screen.Recording.2023-03-28.at.12.07.32.mov

Steps to verify:

  1. Create a dashboard from /app/dashboards#/list, save it and copy the dashboard saved object id from url.
  2. Visit /app/security/dashboards/:dashboardId

Known issues:
#154842
#154843

Checklist

Delete any items that are not applicable to this PR.

@angorayc angorayc self-assigned this Mar 10, 2023
@angorayc angorayc changed the title init dashboards [SecuritySolution] Setup dashboard view page Mar 10, 2023
@angorayc angorayc added release_note:skip Skip the PR/issue when compiling release notes Team:Threat Hunting Security Solution Threat Hunting Team Team:Threat Hunting:Explore v8.8.0 Team: SecuritySolution Security Solutions Team working on SIEM, Endpoint, Timeline, Resolver, etc. labels Mar 10, 2023
@angorayc angorayc force-pushed the dashboard-setup branch 2 times, most recently from e14a558 to 7e77cdc Compare March 24, 2023 17:49
to: nextDateRange.dateRangeTo,
},
});
}
}
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Adding this because the time range of the Visualization wouldn't update after brushing on a time-based histogram / area chart.

brushing_on_chart.mov

After:

Screen.Recording.2023-03-27.at.11.35.47.mov

@angorayc angorayc marked this pull request as ready for review March 27, 2023 16:25
@angorayc angorayc requested review from a team as code owners March 27, 2023 16:25
@elasticmachine
Copy link
Contributor

Pinging @elastic/security-threat-hunting (Team:Threat Hunting)

@elasticmachine
Copy link
Contributor

Pinging @elastic/security-solution (Team: SecuritySolution)

@stratoula
Copy link
Contributor

@angorayc I don't understand why onBrush doesn't work tbh. It works on all visualizations on a dashboard without adding an extra method on unified search. Are you using the onBrushEnd method of Lens embeddable? I think it makes sense first to understand why it doesn't work cc @dej611 if you have any input here.

@dej611
Copy link
Contributor

dej611 commented Mar 28, 2023

@angorayc I don't understand why onBrush doesn't work tbh. It works on all visualizations on a dashboard without adding an extra method on unified search. Are you using the onBrushEnd method of Lens embeddable? I think it makes sense first to understand why it doesn't work cc @dej611 if you have any input here.

Agree with @stratoula that it is better to find out what's going wrong here rather than adding a new method.
I cannot find anything strange from the code yet, but I see it is using an Embedded Dashboard in this page solution rather than a Lens Embeddable. I'll try to investigate on that route.

@stratoula
Copy link
Contributor

cc @ThomThomson for his input here too.

@angorayc
Copy link
Contributor Author

I think the reason that brushing doesn't work because Security Solution doesn't share the same url param structure as others, we do not put time range under _g, and we do not use kbnUrlStateStorage. We sync the url state when query changed by dispatching an action to reducer. If the action isn't triggered when query changed, the time range passed to dashboard wouldn't update.

I was thinking of calling onQueryChange on Line 191, but eventually adding a new prop onTimeRangeChange to be more specific about the date range changed here. What do you think if we remove onTimeRangeChange and just call onQueryChange on src/plugins/unified_search/public/search_bar/search_bar.tsx line 191?

@stratoula
Copy link
Contributor

@angorayc yes I think using the onQueryChange makes more sense to me, do you want to give it a try?

@angorayc
Copy link
Contributor Author

@stratoula , yup, changed onTimeRangeChange to onQueryChange, but still need to call it in src/plugins/unified_search/public/search_bar/search_bar.tsx line 191

@stratoula
Copy link
Contributor

I see, no I suggest to try understand why onBrush doesnt work for embedded dashboards. Let's see if Marco and Devon find anything otherwise I have to check the code.

@angorayc angorayc added the ci:cloud-deploy Create or update a Cloud deployment label Mar 29, 2023
@angorayc
Copy link
Contributor Author

angorayc commented Mar 30, 2023

@ferenrigue , @paulewing

Here's a link to the demo page: https://kibana-pr-153040.kb.us-west2.gcp.elastic-cloud.com:9243/app/security/dashboards/6294c960-ce35-11ed-b8ca-51636b04063c?sourcerer=(default:(id:security-solution-default,selectedPatterns:!(%27auditbeat-*%27,%27logs-*%27)))

https://p.elstc.co/paste/pOFVo-fV#Zgp3hnsnijsDHbki4y9Cy5F+apet-hYEcedpDzsc+f7

The edit button takes user to the dashboards app at the moment. Eventually we should be able to allow users to edit in SecuritySolution’s app.
And the entry of the dashboard view page should be here, will add it later when we think it's ready:
Screenshot 2023-03-30 at 10 50 19

Copy link
Contributor

@stratoula stratoula left a comment

Choose a reason for hiding this comment

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

Thanx Angela, unified search changes LGTM!

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.

Awesome! Thanks for addressing the comments @angorayc
This Dashboard view is super powerful 🔥🔥
LGTM! 🚀

@kibana-ci
Copy link
Collaborator

kibana-ci commented Apr 11, 2023

💚 Build Succeeded

Metrics [docs]

Module Count

Fewer modules leads to a faster build time

id before after diff
securitySolution 3792 3806 +14

Async chunks

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

id before after diff
securitySolution 15.9MB 15.9MB +6.8KB
unifiedSearch 267.5KB 267.6KB +155.0B
total +6.9KB

Page load bundle

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

id before after diff
securitySolution 58.0KB 58.1KB +46.0B
Unknown metric groups

ESLint disabled in files

id before after diff
securitySolution 80 79 -1

ESLint disabled line counts

id before after diff
securitySolution 433 436 +3

Total ESLint disabled count

id before after diff
securitySolution 513 515 +2

History

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

cc @angorayc

@angorayc angorayc merged commit 67af39a into elastic:main Apr 11, 2023
@kibanamachine kibanamachine added the backport:skip This commit does not require backporting label Apr 11, 2023
semd added a commit that referenced this pull request Apr 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 ci:cloud-deploy Create or update a Cloud deployment Feature:Security Dashboards Security solution custom dashboards feature release_note:skip Skip the PR/issue when compiling release notes Team: SecuritySolution Security Solutions Team working on SIEM, Endpoint, Timeline, Resolver, etc. Team:Threat Hunting:Explore Team:Threat Hunting Security Solution Threat Hunting Team v8.8.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants