Repository navigation
Set uiState to Vis from visualization - #15549
Conversation
|
looks good, i will wait for the tests to pass and also give it some more testing before approving :) |
thomasneirynck
left a comment
There was a problem hiding this comment.
Looks good. I tested this with a couple visualizations.
Could you also edit the corresponding docs?
https://www.elastic.co/guide/en/kibana/master/development-vis-editors.html#development-custom-editor
|
@thomasneirynck What would you like to fix there? That an editor might want to pass through the If the custom editor doesn't by chance render the |
|
@timroes fair enough, we skipped over these properties for convenience as not to clutter the doc. So this is only tangentially related to this PR. The mismatching doc doesn't seem to right approach in hindsight. If we continue not to document them, this is a sign the Editor-API needs work. After all, when people write custom editors, they will see 3 (formerly 2) extra parameters passed in, that are very mysterious. And there is a possibly meaningful parameter in there ( So if we're going to expand on the API-method, I'd use the opportunity to improve on getting the doc synced with the actual implementations. Couple of approaches to consider:
The updateStatus flag actually I do think is meaningful, so we can consider keeping it (and documenting it). If so, I'd reorder updateStatus to be 2nd parameter for symmetry. |
We previously passed the
uiStatedown the whole chain from<visualize>to<visualization>, but still required the users of the topmost entry point he uses (most likely<visualize>) to callvis.setUiState(uiSTate)manually, besides passing it down.This PR changes, that behavior, that
<visualization>will now callvis.setUiStatewhenever it gets a newuiState. That way we make it easier to use visualizations, since you are not required to pass the uiState to different methods. There was also no use case earlier, in passing a differentuiStateto the<visualize>directive, than you set viavis.setUiState, it would just cause broken behavior.Fixes #15255 since the visual loader didn't call that method, using it would exactly cause that weird behavior, where you pass a uiState to
<visualize>but never set it viavis.setUiState, in which case you couldn't change any legend colors.Also the visualize editor silently swallowed the
uiStateit got passed in, and the default editor instead would just read back the one already attached to the vis. This PR also properly passes down theuiStatenow also in editor mode.