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

[Dashboard Usability] Unified panel options pane #148301

Merged
merged 39 commits into from
Feb 2, 2023

Conversation

nickpeihl
Copy link
Member

@nickpeihl nickpeihl commented Jan 3, 2023

Fixes #146314

Summary

Adds a panel settings flyover to customize the title, description, and time range for panels in a dashboard. Replaces the "Customize panel title" and "Customize time range" options in the panel context menu with a "Customize panel setting" option.

It is not currently possible to provide description for by-value panels in a dashboard. By-reference panels can have a description, but it must be defined in the saved object. To enable support for custom descriptions on both by-value and by-reference panels this PR adds description and defaultDescription keys to the EmbeddableOutput interface and a getDescription method to the IEmbeddable interface.

CustomizePanelTitleAction and CustomTimeRangeAction have been replaced by CustomizePanelAction. CustomTimeRangeAction was moved from the ui_actions_enhanced plugin to the embeddable plugin. CustomTimeRangeAction was originally Basic licensed, but because of the license change from OSS to SSPL, we no longer need maintain these in separate codebases.

Flaky test runner

Checklist

Delete any items that are not applicable to this PR.

Risk Matrix

Delete this section if it is not applicable to this PR.

Before closing this PR, invite QA, stakeholders, and other developers to identify risks that should be tested prior to the change/feature release.

When forming the risk matrix, consider some of the following examples and how they may potentially impact the change:

Risk Probability Severity Mitigation/Notes
Multiple Spaces—unexpected behavior in non-default Kibana Space. Low High Integration tests will verify that all features are still supported in non-default Kibana Space and when user switches between spaces.
Multiple nodes—Elasticsearch polling might have race conditions when multiple Kibana nodes are polling for the same tasks. High Low Tasks are idempotent, so executing them multiple times will not result in logical error, but will degrade performance. To test for this case we add plenty of unit tests around this logic and document manual testing procedure.
Code should gracefully handle cases when feature X or plugin Y are disabled. Medium High Unit tests will verify that any feature flag or plugin combination still results in our service operational.
See more potential risk examples

For maintainers

nickpeihl and others added 23 commits December 27, 2022 14:53
Unlike EuiTextField, EuiTextArea cannot receive undefined for the value
prop. So we must coerce to a blank string.
@nickpeihl nickpeihl marked this pull request as ready for review January 25, 2023 18:29
@nickpeihl nickpeihl requested review from a team as code owners January 25, 2023 18:29
@nickpeihl
Copy link
Member Author

Looks like I broke panel time ranges for embeddables in Canvas. Working on a fix.

Copy link
Contributor

@ThomThomson ThomThomson left a comment

Choose a reason for hiding this comment

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

Everything LGTM! Ran this locally and tested on a number of dashboards editing or not editing the panel titles and descriptions of a variety of embeddable types both by reference and by value.

Also looked through the code, and the changes are looking great, left a few very small nits.

Appreciate the FTR results - looks like it failed once due to an unrelated flaky test?

One thing - I'm not sure if this is just my computer, but I was having a bug where the unified options pane would animate open twice each time it was clicked:

Double Flyout

@@ -21,6 +21,13 @@ import { genericEmbeddableInputIsEqual, omitGenericEmbeddableInput } from './dif
function getPanelTitle(input: EmbeddableInput, output: EmbeddableOutput) {
return input.hidePanelTitles ? '' : input.title === undefined ? output.defaultTitle : input.title;
}
function getPanelDescription(input: EmbeddableInput, output: EmbeddableOutput) {
return input.hidePanelTitles
Copy link
Contributor

Choose a reason for hiding this comment

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

Is there a way to make this slightly more understandable? Double ternaries can sometimes be head-scratching.

@@ -187,6 +195,10 @@ export abstract class Embeddable<
return this.output.title || '';
}

public getDescription(): string {
return this.output.description || '';
Copy link
Contributor

Choose a reason for hiding this comment

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

super tiny nit: Would using ?? be more correct here? With this code, if the output.description was already a blank string it would fail the check and return the fallback. The behaviour is completely the same - which is why this is a super tiny nit!

return new Promise<{ title: string | undefined; hideTitle?: boolean }>((resolve) => {
const session = overlays.openModal(
toMountPoint(
<CustomizePanelModal
Copy link
Contributor

Choose a reason for hiding this comment

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

Wow, I didn't realise this code lived right inside the embeddable panel before, nice clean up!

onClose();
};

const renderCustomTitleComponent = () => {
Copy link
Contributor

Choose a reason for hiding this comment

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

Eventually we could split these up into separate files, might be a good follow-up PR, especially as this window is only expected to grow!

Copy link
Member Author

Choose a reason for hiding this comment

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

Yup. Happy to work on a follow-up PR for this. 👍

@KOTungseth
Copy link
Contributor

THIS is amazing!

I have a few suggestions for the UI copy.

image

For Controls, the settings page header is Control settings. Can we simply the panel settings header to Panel settings instead of Edit panel settings?

Since the header includes the word panel, can we remove panel from the subsequent fields? (This is common in other save modals)

Show panel title -> Show title or Display title

Panel title -> Title

Panel description -> Description

Apply custom time range to panel -> Apply custom time range

Panel time range -> Custom time range

cc: @gchaps @florent-leborgne

@nickpeihl nickpeihl added the Team:Presentation Presentation Team for Dashboard, Input Controls, and Canvas label Feb 2, 2023
@elasticmachine
Copy link
Contributor

Pinging @elastic/kibana-presentation (Team:Presentation)

@kibana-ci
Copy link
Collaborator

💚 Build Succeeded

Metrics [docs]

Module Count

Fewer modules leads to a faster build time

id before after diff
embeddable 75 78 +3
uiActionsEnhanced 155 151 -4
total -1

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
embeddable 427 430 +3
lens 599 598 -1
maps 267 266 -1
visualizations 771 770 -1
total -0

Async chunks

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

id before after diff
dashboard 364.6KB 364.6KB +20.0B
discover 382.9KB 382.9KB -20.0B
lens 1.3MB 1.3MB +84.0B
maps 2.7MB 2.7MB -122.0B
ml 3.4MB 3.4MB +132.0B
uiActionsEnhanced 135.1KB 131.9KB -3.1KB
visualizations 258.4KB 258.4KB -12.0B
total -3.1KB

Page load bundle

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

id before after diff
embeddable 69.2KB 73.4KB +4.3KB
uiActionsEnhanced 20.3KB 16.8KB -3.4KB
total +876.0B
Unknown metric groups

API count

id before after diff
embeddable 528 532 +4
lens 694 693 -1
maps 268 267 -1
visualizations 801 800 -1
total +1

async chunk count

id before after diff
uiActionsEnhanced 5 4 -1

History

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

@nickpeihl nickpeihl merged commit ace2c30 into elastic:main Feb 2, 2023
@kibanamachine kibanamachine added the backport:skip This commit does not require backporting label Feb 2, 2023
kqualters-elastic pushed a commit to kqualters-elastic/kibana that referenced this pull request Feb 6, 2023
## Summary

Closes elastic#148563

After this [PR](
elastic#148301) being merged, it will be
easier to add the description info icon and the custom data range to the
new metric. For this reason we decided to also allow the panel title for
now.

On the next minors we are going to hide it from the panel and display
all the aforementioned info on the viz title.
<img width="988" alt="image"
src="https://user-images.githubusercontent.com/17003240/215037834-0f556673-8628-484e-aa32-c34188fc7064.png">

### 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
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:Embedding Embedding content via iFrame release_note:enhancement Team:Presentation Presentation Team for Dashboard, Input Controls, and Canvas ui-copy Review of UI copy with docs team is recommended v8.7.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Dashboard Usability] Centralize Panel Editing - Title, Description & Time Range