-
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
[Lens] Fix embeddable title and description for reporting and dashboard tooltip #78767
Changes from 6 commits
eb3cd0f
9455c42
7f66e63
fc990e8
92e476e
8e8526f
31a9d54
d3b10b5
997c58a
c4455a3
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -109,11 +109,10 @@ function renderTooltip(description: string) { | |
); | ||
} | ||
|
||
const VISUALIZE_EMBEDDABLE_TYPE = 'visualization'; | ||
type VisualizeEmbeddable = any; | ||
|
||
function getViewDescription(embeddable: IEmbeddable | VisualizeEmbeddable) { | ||
if (embeddable.type === VISUALIZE_EMBEDDABLE_TYPE) { | ||
if (embeddable.getVisualizationDescription) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Could this be |
||
const description = embeddable.getVisualizationDescription(); | ||
|
||
if (description) { | ||
|
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -61,6 +61,8 @@ export async function persistedStateToExpression( | |
state: { visualization: visualizationState, datasourceStates: persistedDatasourceStates }, | ||
visualizationType, | ||
references, | ||
title, | ||
description, | ||
} = doc; | ||
if (!visualizationType) return null; | ||
const visualization = visualizations[visualizationType!]; | ||
|
@@ -79,7 +81,7 @@ export async function persistedStateToExpression( | |
|
||
return buildExpression({ | ||
visualization, | ||
visualizationState, | ||
visualizationState: { ...(visualizationState as object), title, description }, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm not sure I like this approach - it assumes a certain state structure we don't guarantee and it seems like it's breaking the current isolation between frame and individual visualizations to magically set state. |
||
datasourceMap: datasources, | ||
datasourceStates, | ||
datasourceLayers, | ||
|
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
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.
I know this wasn't added in this PR, but I'm not a huge fan of using
any
like this. Now that thisdescription
is added to both lens and visualize, I wonder if it would be worth adding an optionalgetDescription
function toIEmbeddable
.If not, at least the
any
could be removed with something like: