Skip to content

Commit

Permalink
🐛 Refactor fix to make it work correctly in Dashboard
Browse files Browse the repository at this point in the history
  • Loading branch information
dej611 committed Jul 22, 2020
1 parent d4d7104 commit 9737438
Showing 1 changed file with 11 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -215,9 +215,16 @@ export class VisualizeEmbeddable extends Embeddable<VisualizeInput, VisualizeOut
dirty = true;
}

if (this.output.title !== this.title || this.title !== this.vis.title) {
// Output has priority, but use vis.title as fallback
this.title = this.output.title || this.vis.title;
// propagate the title to the output embeddable
// but only when the visualization is in edit/Visualize mode
if (!this.parent && this.vis.title !== this.output.title) {
this.updateOutput({ title: this.vis.title });
}

// Keep title depending on the output Embeddable to decouple the
// visual appearance of the title and the actual title content (useful in Dashboard)
if (this.output.title !== this.title) {
this.title = this.output.title;

if (this.domNode) {
this.domNode.setAttribute('data-title', this.title || '');
Expand Down Expand Up @@ -315,7 +322,7 @@ export class VisualizeEmbeddable extends Embeddable<VisualizeInput, VisualizeOut
})
);

div.setAttribute('data-title', this.title || '');
div.setAttribute('data-title', this.output.title || '');

if (this.vis.description) {
div.setAttribute('data-description', this.vis.description);
Expand Down

0 comments on commit 9737438

Please sign in to comment.