Need a special offer?Find out if your project fits.
+

Showing custom error messages for flexmonster with elasticsearch

Answered
amir asked on March 19, 2021

How can I show custom error message for my flexmonster chart with elasticsearch if my elasticsearch index is not available (or say elasticsearch server is down) instead of just showing default Error alert box  

Attachments:
fm-error.PNG

3 answers

Public
Illia Yatsyshyn Illia Yatsyshyn Flexmonster March 19, 2021

Hello,
 
Thank you for contacting us.
 
We suggest using the olapstructureerror event in combination with the alert API call to handle some of these scenarios.
Our team prepared the JSFiddle to demonstrate this approach: https://jsfiddle.net/flexmonster/py25w1h3/.
 
Please let us know if it works well for your case.
We are looking forward to hearing from you.
 
Best regards,
Illia

Public
amir March 20, 2021

Yes, thank you this worked.
 What are the other cases (apart from not loading elasticsearch index), this event will get triggered??? There is not much detail about this in docs. I am concerned because i have different kind of flexmonster charts and grids in my application. i want to restrict this to charts usinig elasticsearch 
 

Public
Illia Yatsyshyn Illia Yatsyshyn Flexmonster March 22, 2021

Hello,
 
Thank you for your feedback. We are happy to hear this works well for you.
 
The olapstructureerror event is only triggered if any errors appear while loading the structure of the Elasticsearch index. It implies the unavailability of the index itself.
 
If we understand correctly, your concerns are that this event may be triggered in an unexpected or unwanted situation. If so, we would like to confirm that this event is only triggered under the circumstances mentioned earlier.
 
Also, if you want to use this event only for some Flexmonster instances (for example, only for the ones displaying charts), in that case, we suggest subscribing to this event using the corresponding reference to the instance.

let pivot = new Flexmonster({
  ...
});

pivot.on('olapstructureerror', function(e) {
  pivot.alert({
  ...
});

 
We hope it works.
If we did not understand some parts of your question in the right way, please provide further details or illustrations.
 
Best regards,
Illia

Please login or Register to Submit Answer