Auto Refresh Dashboard based on Elasticube Build or Refresh Every Dashboard Widget

Comments

3 comments

  • Avatar
    Daan Krijnen

    Been using this script up until I updated to 7.2, which broke the revision API for me. Awaiting the support ticket on the API I rewrote this to work with a different API call (getElasticube). I'm no Javascript coder, so probably not the smoothest way to get this working.

     

    var serverURL = 'http://[yourserverip]:8081';

    var elasticubeName = '[ElasticubeName]';

    var seconds = 15;

    var lastBuild = null;

    var settings = {

    "async": true,

    "crossDomain": true,

    "url": serverURL + "/api/v1/elasticubes/getElasticubes",

    "method": "GET",

    "headers": {

    "content-type": "application/x-www-form-urlencoded"

    }

    }



    //looks up the build time of the build, and if the build time changes, than that

    //means a build occurred and a auto-refresh occurs

    function checkElasticubeBuildStatus(){

    $.ajax(settings).done(function (response) {

    for( x in response) {

    if(response[x].title === elasticubeName) {

    if(lastBuild === null){
    lastBuild = response[x].lastBuildTime;
    console.log(response[x].lastBuildTime);
    }
    else if(lastBuild != response[x].lastBuildTime) {

    location.reload();

    }
    else{

    }

    }

    else{
    }

    }
    }

    setTimeout(checkElasticubeBuildStatus, seconds*1000);

    });

    }



    //Recursive function to keep checking build status

    checkElasticubeBuildStatus();
    0
    Comment actions Permalink
  • Avatar
    Benjamin Eshet

    Hi Elliott,

    Thanks for the script.
    I'm looking to combine both into one - refresh every widget when the cube is rebuilt.
    Having the entire dashboard reloaded can be troublesome if the user is in the middle of an interaction with it, and having the widgets refresh every x minutes is great, but just not enough for my client (plus, it can quickly cause the browser to reach a call stack limit due to the recursion).

    Do you have a suggestion how to achieve this? Maybe trigger widget refresh when a new revision is identified?

    0
    Comment actions Permalink
  • Avatar
    Ravid Paldi

    Hi @Benjamin,

     

    Ravid here from Paldi Solutions a certified implementation partner of Sisense 

    What you're describing is exactly our specialty and I'd be happy to jump on a call to learn more about your use case and recommend on a proper solution with a price quote or give you some guidelines of the solution for your dev team to implement on your own. 

    With the above in mind, few specific notes/questions:

    - You can fairly easy modify the two scripts so it will refresh only the widgets and only upon a detection of new build that had finished. 

    - From past experience with other clients, you are correct with your concern about damaging your users' experience and the stability of your dashboards. 

    - A key factor in the proposed solution is your current Data Freshness so - how often your cube is being built? 

    - Is there a specific subset of widgets that needs to be kept up-to-date at all times or you need all of them to be updated? 

    - You don't really have a "solid" way to check whether a  user is currently interacting with a widget so if this is a big concern, it will be a better idea to popup a massage at the widget scope that the data is not up to date and prompt the user to actively press a button to refresh the widget. 

    -  Generally speaking, you should take the scripts in this post and convert them into a more manageable plugin as all the setting are hardcoded and needs to be applied to edit script of every dashboard you have. This stack have a huge potentials for errors when you deploy versions of you dashboards, scripts and even cubes.  

    Feel free to reach out for more info

    ravid@paldi.solutions

     

    Until then, have a superb 2020

    Ravid

     

    0
    Comment actions Permalink

Please sign in to leave a comment.