-
Notifications
You must be signed in to change notification settings - Fork 8.3k
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
Visualize: Reload on ui state change and fix ui state for tsvb #63699
Merged
Merged
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
81f7302
pass through reload information and ui state
flash1293 506715f
emit reload directly
flash1293 43ee1ee
Merge remote-tracking branch 'upstream/master' into fix-tsvb-table-so…
flash1293 648ccfe
Merge branch 'master' into fix-tsvb-table-sorting
elasticmachine 45e05aa
Merge branch 'master' into fix-tsvb-table-sorting
elasticmachine 9919d99
Merge branch 'master' into fix-tsvb-table-sorting
elasticmachine ac37e17
Merge branch 'master' into fix-tsvb-table-sorting
elasticmachine 9fe498d
Merge remote-tracking branch 'upstream/master' into fix-tsvb-table-so…
flash1293 a72c4b0
unregister ui state listener
flash1293 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -60,6 +60,7 @@ export interface VisualizeInput extends EmbeddableInput { | |
vis?: { | ||
colors?: { [key: string]: string }; | ||
}; | ||
table?: unknown; | ||
} | ||
|
||
export interface VisualizeOutput extends EmbeddableOutput { | ||
|
@@ -77,7 +78,7 @@ export class VisualizeEmbeddable extends Embeddable<VisualizeInput, VisualizeOut | |
private query?: Query; | ||
private title?: string; | ||
private filters?: Filter[]; | ||
private visCustomizations: VisualizeInput['vis']; | ||
private visCustomizations?: Pick<VisualizeInput, 'vis' | 'table'>; | ||
private subscriptions: Subscription[] = []; | ||
private expression: string = ''; | ||
private vis: Vis; | ||
|
@@ -108,6 +109,7 @@ export class VisualizeEmbeddable extends Embeddable<VisualizeInput, VisualizeOut | |
this.timefilter = timefilter; | ||
this.vis = vis; | ||
this.vis.uiState.on('change', this.uiStateChangeHandler); | ||
this.vis.uiState.on('reload', this.reload); | ||
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. This is making sure the reload is picked up when visualize embeddable is used on the dashboard |
||
|
||
this.autoRefreshFetchSubscription = timefilter | ||
.getAutoRefreshFetch$() | ||
|
@@ -149,17 +151,22 @@ export class VisualizeEmbeddable extends Embeddable<VisualizeInput, VisualizeOut | |
// Check for changes that need to be forwarded to the uiState | ||
// Since the vis has an own listener on the uiState we don't need to | ||
// pass anything from here to the handler.update method | ||
const visCustomizations = this.input.vis; | ||
if (visCustomizations) { | ||
const visCustomizations = { vis: this.input.vis, table: this.input.table }; | ||
if (visCustomizations.vis || visCustomizations.table) { | ||
if (!_.isEqual(visCustomizations, this.visCustomizations)) { | ||
this.visCustomizations = visCustomizations; | ||
// Turn this off or the uiStateChangeHandler will fire for every modification. | ||
this.vis.uiState.off('change', this.uiStateChangeHandler); | ||
this.vis.uiState.clearAllKeys(); | ||
this.vis.uiState.set('vis', visCustomizations); | ||
getKeys(visCustomizations).forEach(key => { | ||
this.vis.uiState.set(key, visCustomizations[key]); | ||
}); | ||
if (visCustomizations.vis) { | ||
this.vis.uiState.set('vis', visCustomizations.vis); | ||
getKeys(visCustomizations).forEach(key => { | ||
this.vis.uiState.set(key, visCustomizations[key]); | ||
}); | ||
} | ||
if (visCustomizations.table) { | ||
this.vis.uiState.set('table', visCustomizations.table); | ||
} | ||
this.vis.uiState.on('change', this.uiStateChangeHandler); | ||
} | ||
} else if (this.parent) { | ||
|
@@ -307,6 +314,7 @@ export class VisualizeEmbeddable extends Embeddable<VisualizeInput, VisualizeOut | |
super.destroy(); | ||
this.subscriptions.forEach(s => s.unsubscribe()); | ||
this.vis.uiState.off('change', this.uiStateChangeHandler); | ||
this.vis.uiState.off('reload', this.reload); | ||
|
||
if (this.handler) { | ||
this.handler.destroy(); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
This is re-running the expression when ui state changes in TSVB