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

[Portable Dashboards] Implementation Feature Branch #144332

Merged

Conversation

ThomThomson
Copy link
Contributor

@ThomThomson ThomThomson commented Nov 1, 2022

Closes #136771
Closes #136770
Fixes #140243

For reviewers

This isn't a mistake, just a very large PR. @elastic/security-solution and @elastic/ml-ui reviews are only required due to import / naming changes.

Summary

This PR makes Dashboards Portable. Instead of being tightly coupled to the Dashboard App, the Dashboard Container can now be used in any plugin via the Dashboard Container Renderer component in src/plugins/dashboard/public/dashboard_container/dashboard_container_renderer.tsx. The Dashboard Container renderer is one of the first examples of Experience Building Blocks in Kibana.

What is an Experience Building Block

An Experience building block is fundamentally a React Component that consumers interact with imperatively rather than declaratively. In practice this means that rather than passing in props and callbacks, consumers interact with an API instance created and returned by the renderer.

Screen Shot 2022-11-23 at 3 33 51 PM

This is better for large components because it allows for proper encapsulation. When interacting with a component declaratively, the consumer must manage all state required for the component to work. They must use their own state management system, and they must provide their own data fetching capabilities.

Instead, the goal of this PR and others like it is to provide fundamental, stateful, data-fetching, pieces of UI that can be used in concert with one another.

How is this experience building block consumed?

⚠️ With this PR, no documentation has been added quite yet, but we will begin adding documentation soon. In the meantime, this brief introduction into interacting with a portable dashboard will hopefully suffice.

Dashboards are likely the most complicated experience building block we will expose. That said, thanks to the internal state management, consuming a portable Dashboard is not terribly difficult. The consumer will interact with the dashboard with one string, and two callbacks:

  1. Saved Object Id
    A saved object ID string can optionally be passed into the dashboard. If one is supplied, this dashboard will be created by reference by loading that saved object ID as a dashboard saved object. This prop is declarative, meaning that if it changes, the dashboard will reload itself to reflect the new saved object ID.

  2. Get creation Options
    This callback answers the question "what does the initial state of my dashboard look like". The implementor will need to return a DashboardCreationOptions object which provides an initial state, and settings for any integrations they would like to set up.

  3. **On dashboard container loaded **
    This callback returns the implementor the fully loaded and initialized Dashboard Container. The Implementor can then use the dashboard API in response to user input to affect the state of the Dashboard Additionally, the implementor has access to a selector that can be used to re-render react components in response to changes in the Dashboard's state.

Screen Shot 2022-11-23 at 3 48 34 PM

Examples

While we will be providing usage examples (definitions of possible examples can be found here), the first consumer of this building block is the dashboard app itself. The dashboard app is also the most feature-complete implementation, as it makes use of each integration offered by the portable dashboard container.

ThomThomson and others added 30 commits September 29, 2022 17:34
…e. Used Redux tools in Dashboard components. Built system for passing incoming embeddable to portable dashboard
…plement URL state sync on Dashboard app side.
…ctions. Make dashboard diffing start synchronous. Ensure default data view on dashboard start. assign incoming embeddable type.
@ThomThomson
Copy link
Contributor Author

Thanks for the review @nickpeihl! I've addressed the comments - mostly by creating follow-up tech debt issues! Tomorrow I will look into why the time slider has stopped working properly.

@kibana-ci
Copy link
Collaborator

💚 Build Succeeded

Metrics [docs]

Module Count

Fewer modules leads to a faster build time

id before after diff
dashboard 357 352 -5

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
dashboard 114 109 -5
presentationUtil 171 174 +3
total -2

Async chunks

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

id before after diff
controls 454.3KB 454.3KB -13.0B
dashboard 404.2KB 368.1KB -36.1KB
ml 3.4MB 3.4MB -48.0B
presentationUtil 130.7KB 130.4KB -318.0B
securitySolution 10.1MB 10.1MB -8.0B
total -36.5KB

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
dashboard 3 2 -1
presentationUtil 12 11 -1
total -2

Page load bundle

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

id before after diff
controls 35.5KB 35.5KB +1.0B
dashboard 41.3KB 25.3KB -16.1KB
dashboardEnhanced 15.2KB 15.1KB -24.0B
embeddable 69.7KB 69.8KB +151.0B
presentationUtil 40.7KB 40.8KB +103.0B
total -15.8KB
Unknown metric groups

API count

id before after diff
dashboard 121 113 -8
embeddable 513 514 +1
presentationUtil 227 230 +3
total -4

async chunk count

id before after diff
dashboard 7 8 +1

ESLint disabled in files

id before after diff
osquery 1 2 +1

ESLint disabled line counts

id before after diff
dashboard 7 6 -1
enterpriseSearch 19 21 +2
fleet 60 66 +6
osquery 109 115 +6
securitySolution 445 451 +6
total +19

Total ESLint disabled count

id before after diff
dashboard 7 6 -1
enterpriseSearch 20 22 +2
fleet 69 75 +6
osquery 110 117 +7
securitySolution 521 527 +6
total +20

History

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

Copy link
Member

@nickpeihl nickpeihl left a comment

Choose a reason for hiding this comment

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

lgtm!

code review and tested dashboard app functionalities

@ThomThomson ThomThomson merged commit f3af8e0 into elastic:main Dec 15, 2022
@kibanamachine kibanamachine added v8.7.0 backport:skip This commit does not require backporting labels Dec 15, 2022
jbudz added a commit to jbudz/kibana that referenced this pull request Dec 15, 2022
nreese added a commit that referenced this pull request Jan 30, 2023
Fixes #126000

Unskip tests in
/Users/nreese/projects/kibana/src/plugins/dashboard/public/dashboard_container/component/grid/dashboard_grid.test.tsx

viewport/dashboard_viewport.test.tsx removed in
#144332.

---------

Co-authored-by: kibanamachine <[email protected]>
kqualters-elastic pushed a commit to kqualters-elastic/kibana that referenced this pull request Feb 6, 2023
Fixes elastic#126000

Unskip tests in
/Users/nreese/projects/kibana/src/plugins/dashboard/public/dashboard_container/component/grid/dashboard_grid.test.tsx

viewport/dashboard_viewport.test.tsx removed in
elastic#144332.

---------

Co-authored-by: kibanamachine <[email protected]>
Heenawter added a commit that referenced this pull request Nov 16, 2023
Closes #162800

## Summary

This PR re-adds dashboard titles to the browser tab title, which was
accidentally removed as part of the [portable
dashboards](#144332) work. For
example, if I'm on the sample Logs dashboard, the title of that
dashboard will now be reflected in the tab title like it was prior to
`v8.7.0`:


| Before | After |
|--------|--------|
|
![image](https://github.com/elastic/kibana/assets/8698078/79044734-f9f5-41e2-b7e6-27087d37832d)
|
![image](https://github.com/elastic/kibana/assets/8698078/e82740a8-b4ef-488e-981a-57b5ef39948a)
|


The tab title should stay up-to-date with Dashboard title changes, as
demonstrated in this video:


https://github.com/elastic/kibana/assets/8698078/651fff50-70f7-46ff-af47-b274fe6b0a19




Note that this will **only apply** to dashboards in the dashboard app -
dashboards outside of the dashboard app should not change the browser
tab title, unless the consumer does this on their own.

### [Flaky Test
Runner](https://buildkite.com/elastic/kibana-flaky-test-suite-runner/builds/3987)


![image](https://github.com/elastic/kibana/assets/8698078/aec4100b-9e76-4154-b20b-a7054f7f46a1)


### Checklist

- [x] [Unit or functional
tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)
were updated or added to match the most common scenarios
- [x] This was checked for [cross-browser
compatibility](https://www.elastic.co/support/matrix#matrix_browsers)

### For maintainers

- [ ] This was checked for breaking API changes and was [labeled
appropriately](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)
kibanamachine pushed a commit to kibanamachine/kibana that referenced this pull request Nov 16, 2023
Closes elastic#162800

## Summary

This PR re-adds dashboard titles to the browser tab title, which was
accidentally removed as part of the [portable
dashboards](elastic#144332) work. For
example, if I'm on the sample Logs dashboard, the title of that
dashboard will now be reflected in the tab title like it was prior to
`v8.7.0`:

| Before | After |
|--------|--------|
|
![image](https://github.com/elastic/kibana/assets/8698078/79044734-f9f5-41e2-b7e6-27087d37832d)
|
![image](https://github.com/elastic/kibana/assets/8698078/e82740a8-b4ef-488e-981a-57b5ef39948a)
|

The tab title should stay up-to-date with Dashboard title changes, as
demonstrated in this video:

https://github.com/elastic/kibana/assets/8698078/651fff50-70f7-46ff-af47-b274fe6b0a19

Note that this will **only apply** to dashboards in the dashboard app -
dashboards outside of the dashboard app should not change the browser
tab title, unless the consumer does this on their own.

### [Flaky Test
Runner](https://buildkite.com/elastic/kibana-flaky-test-suite-runner/builds/3987)

![image](https://github.com/elastic/kibana/assets/8698078/aec4100b-9e76-4154-b20b-a7054f7f46a1)

### Checklist

- [x] [Unit or functional
tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)
were updated or added to match the most common scenarios
- [x] This was checked for [cross-browser
compatibility](https://www.elastic.co/support/matrix#matrix_browsers)

### For maintainers

- [ ] This was checked for breaking API changes and was [labeled
appropriately](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)

(cherry picked from commit 6150f76)
kibanamachine added a commit that referenced this pull request Nov 17, 2023
…#171454)

# Backport

This will backport the following commits from `main` to `8.11`:
- [[Dashboard] Add Dashboard title to browser tab title
(#171255)](#171255)

<!--- Backport version: 8.9.7 -->

### Questions ?
Please refer to the [Backport tool
documentation](https://github.com/sqren/backport)

<!--BACKPORT [{"author":{"name":"Hannah
Mudge","email":"[email protected]"},"sourceCommit":{"committedDate":"2023-11-16T23:23:22Z","message":"[Dashboard]
Add Dashboard title to browser tab title (#171255)\n\nCloses
https://github.com/elastic/kibana/issues/162800\r\n\r\n##
Summary\r\n\r\nThis PR re-adds dashboard titles to the browser tab
title, which was\r\naccidentally removed as part of the
[portable\r\ndashboards](#144332)
work. For\r\nexample, if I'm on the sample Logs dashboard, the title of
that\r\ndashboard will now be reflected in the tab title like it was
prior to\r\n`v8.7.0`:\r\n\r\n\r\n| Before | After
|\r\n|--------|--------|\r\n|\r\n![image](https://github.com/elastic/kibana/assets/8698078/79044734-f9f5-41e2-b7e6-27087d37832d)\r\n|\r\n![image](https://github.com/elastic/kibana/assets/8698078/e82740a8-b4ef-488e-981a-57b5ef39948a)\r\n|\r\n\r\n\r\nThe
tab title should stay up-to-date with Dashboard title changes,
as\r\ndemonstrated in this
video:\r\n\r\n\r\nhttps://github.com/elastic/kibana/assets/8698078/651fff50-70f7-46ff-af47-b274fe6b0a19\r\n\r\n\r\n\r\n\r\nNote
that this will **only apply** to dashboards in the dashboard app
-\r\ndashboards outside of the dashboard app should not change the
browser\r\ntab title, unless the consumer does this on their
own.\r\n\r\n### [Flaky
Test\r\nRunner](https://buildkite.com/elastic/kibana-flaky-test-suite-runner/builds/3987)\r\n\r\n\r\n![image](https://github.com/elastic/kibana/assets/8698078/aec4100b-9e76-4154-b20b-a7054f7f46a1)\r\n\r\n\r\n###
Checklist\r\n\r\n- [x] [Unit or
functional\r\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\r\nwere
updated or added to match the most common scenarios\r\n- [x] This was
checked for
[cross-browser\r\ncompatibility](https://www.elastic.co/support/matrix#matrix_browsers)\r\n\r\n###
For maintainers\r\n\r\n- [ ] This was checked for breaking API changes
and was
[labeled\r\nappropriately](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)","sha":"6150f76abae664856a976bc230b9e90dbd844621","branchLabelMapping":{"^v8.12.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["bug","Feature:Dashboard","release_note:fix","Team:Presentation","loe:small","impact:high","backport:prev-minor","ci:cloud-deploy","v8.12.0"],"number":171255,"url":"https://github.com/elastic/kibana/pull/171255","mergeCommit":{"message":"[Dashboard]
Add Dashboard title to browser tab title (#171255)\n\nCloses
https://github.com/elastic/kibana/issues/162800\r\n\r\n##
Summary\r\n\r\nThis PR re-adds dashboard titles to the browser tab
title, which was\r\naccidentally removed as part of the
[portable\r\ndashboards](#144332)
work. For\r\nexample, if I'm on the sample Logs dashboard, the title of
that\r\ndashboard will now be reflected in the tab title like it was
prior to\r\n`v8.7.0`:\r\n\r\n\r\n| Before | After
|\r\n|--------|--------|\r\n|\r\n![image](https://github.com/elastic/kibana/assets/8698078/79044734-f9f5-41e2-b7e6-27087d37832d)\r\n|\r\n![image](https://github.com/elastic/kibana/assets/8698078/e82740a8-b4ef-488e-981a-57b5ef39948a)\r\n|\r\n\r\n\r\nThe
tab title should stay up-to-date with Dashboard title changes,
as\r\ndemonstrated in this
video:\r\n\r\n\r\nhttps://github.com/elastic/kibana/assets/8698078/651fff50-70f7-46ff-af47-b274fe6b0a19\r\n\r\n\r\n\r\n\r\nNote
that this will **only apply** to dashboards in the dashboard app
-\r\ndashboards outside of the dashboard app should not change the
browser\r\ntab title, unless the consumer does this on their
own.\r\n\r\n### [Flaky
Test\r\nRunner](https://buildkite.com/elastic/kibana-flaky-test-suite-runner/builds/3987)\r\n\r\n\r\n![image](https://github.com/elastic/kibana/assets/8698078/aec4100b-9e76-4154-b20b-a7054f7f46a1)\r\n\r\n\r\n###
Checklist\r\n\r\n- [x] [Unit or
functional\r\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\r\nwere
updated or added to match the most common scenarios\r\n- [x] This was
checked for
[cross-browser\r\ncompatibility](https://www.elastic.co/support/matrix#matrix_browsers)\r\n\r\n###
For maintainers\r\n\r\n- [ ] This was checked for breaking API changes
and was
[labeled\r\nappropriately](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)","sha":"6150f76abae664856a976bc230b9e90dbd844621"}},"sourceBranch":"main","suggestedTargetBranches":[],"targetPullRequestStates":[{"branch":"main","label":"v8.12.0","labelRegex":"^v8.12.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/171255","number":171255,"mergeCommit":{"message":"[Dashboard]
Add Dashboard title to browser tab title (#171255)\n\nCloses
https://github.com/elastic/kibana/issues/162800\r\n\r\n##
Summary\r\n\r\nThis PR re-adds dashboard titles to the browser tab
title, which was\r\naccidentally removed as part of the
[portable\r\ndashboards](#144332)
work. For\r\nexample, if I'm on the sample Logs dashboard, the title of
that\r\ndashboard will now be reflected in the tab title like it was
prior to\r\n`v8.7.0`:\r\n\r\n\r\n| Before | After
|\r\n|--------|--------|\r\n|\r\n![image](https://github.com/elastic/kibana/assets/8698078/79044734-f9f5-41e2-b7e6-27087d37832d)\r\n|\r\n![image](https://github.com/elastic/kibana/assets/8698078/e82740a8-b4ef-488e-981a-57b5ef39948a)\r\n|\r\n\r\n\r\nThe
tab title should stay up-to-date with Dashboard title changes,
as\r\ndemonstrated in this
video:\r\n\r\n\r\nhttps://github.com/elastic/kibana/assets/8698078/651fff50-70f7-46ff-af47-b274fe6b0a19\r\n\r\n\r\n\r\n\r\nNote
that this will **only apply** to dashboards in the dashboard app
-\r\ndashboards outside of the dashboard app should not change the
browser\r\ntab title, unless the consumer does this on their
own.\r\n\r\n### [Flaky
Test\r\nRunner](https://buildkite.com/elastic/kibana-flaky-test-suite-runner/builds/3987)\r\n\r\n\r\n![image](https://github.com/elastic/kibana/assets/8698078/aec4100b-9e76-4154-b20b-a7054f7f46a1)\r\n\r\n\r\n###
Checklist\r\n\r\n- [x] [Unit or
functional\r\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\r\nwere
updated or added to match the most common scenarios\r\n- [x] This was
checked for
[cross-browser\r\ncompatibility](https://www.elastic.co/support/matrix#matrix_browsers)\r\n\r\n###
For maintainers\r\n\r\n- [ ] This was checked for breaking API changes
and was
[labeled\r\nappropriately](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)","sha":"6150f76abae664856a976bc230b9e90dbd844621"}}]}]
BACKPORT-->

Co-authored-by: Hannah Mudge <[email protected]>
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:Dashboard Dashboard related features Feature:Drilldowns Embeddable panel Drilldowns Feature:Embedding Embedding content via iFrame impact:critical This issue should be addressed immediately due to a critical level of impact on the product. loe:x-large Extra Large Level of Effort Project:Portable Dashboard Related to the Portable Dashboards initiative release_note:skip Skip the PR/issue when compiling release notes Team:Presentation Presentation Team for Dashboard, Input Controls, and Canvas v8.7.0
Projects
None yet
8 participants