Plugin development : doc/example to validate editor options

Is there a doc or an example (url on a github code for example) that shows how to validate editor options and raise properly an error to user ?

Sorry, I'm not sure I understand the question. Could you be more specific?

Hi @Bill_McConaghy,

  • Suppose I created a visualization plugin
  • In edition mode, I have an 'Options' tab with a text parameter named 'Param1'
  • Now, user edits visualization, fullfills 'Param1' content, and click on 'Apply Changes' button
  • As a plugin developer, I want to catch this event, validate 'Param1' content, and if invalid, raise an error with a clean error message, that will be properly displayed to user as a blocking error : red bar on top with the message, or something like that.
  • Do you have a doc or an example that do this feature ? I mean a code that both detect 'Apply Changes' action and which raises a nice error message to user (not a stack trace in browser console)

Thanks for the details. I found this blog post which goes into pretty good depth about visualization plugin development but did not find anything about form validation:


I'm not sure where there is a good example for what you are trying to do.

You can use angular form validators like ng-requiredas well as html form validators like required.

There is also $scope.visualizeEditor which is the angular form controller for the whole form.

I am not aware of any documentation or examples around it, but general angular form validation documentation should be a good start.

Thanks @ppisljar @Bill_McConaghy for your answers !

I would love to use something like ng-required, but in my case, it's quite complicated.

To be more precise, I develop kibana-enhanced-table which is like a Data Table, but with enhanced features.
I currently add a new feature that allow to 'Split Cols'. So it's a new bucket type.
I want to force that this bucket is the last one. So I want to raise an error, if it is not the last one.
But as it not me that generates HTML code (Kibana core does it), I can't add an angular directive.

That's why I would like to listen 'Apply Changes' event.
Thus, I would like to know which Kibana API to call to display a beautiful error to user (not a stack trace).

Ideally, if you know a plugin (core plugin or community plugin) that does this kind of future, it would be perfect !

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.