Github user sylvinus commented on the issue:

    https://github.com/apache/spark/pull/9860
  
    Might I suggest we have another look at this, to save users from breaking 
their cmd-R keys? :-)
    
    This JS snippet (which you can paste in the Chrome console to test) solves 
2 of the issues mentioned here:
     - Doesn't refresh if the Spark UI stopped to avoid losing results
     - Doesn't refresh if the page is not currently visible
    
    ```
    (function() {
    
    function tinyxhr(url,cb,method,post,contenttype){var 
c=url,a=cb,i=method,f=post,b=contenttype;var d,h;try{h=new 
XMLHttpRequest()}catch(g){try{h=new 
ActiveXObject("Msxml2.XMLHTTP")}catch(g){if(console){console.log("tinyxhr: 
XMLHttpRequest not supported")}return 
null}}d=setTimeout(function(){h.abort();a(new Error("tinyxhr: aborted by a 
timeout"),"",h)},10000);h.onreadystatechange=function(){if(h.readyState!=4){return}clearTimeout(d);a(h.status!=200?new
 Error("tinyxhr: server respnse status is 
"+h.status):false,h.responseText,h)};h.open(i?i.toUpperCase():"GET",c,true);if(!f){h.send()}else{h.setRequestHeader("Content-type",b?b:"application/x-www-form-urlencoded");h.send(f)}};
    
    function spark_refresh() {
        var delay = 2000;
        if (document.hidden) return setTimeout(spark_refresh, delay);
        tinyxhr(window.location.toString(), function(error, html) {
                if (error) return;
                document.documentElement.innerHTML = html;
                setTimeout(spark_refresh, delay);
        }, "GET");
    }
    
    spark_refresh();
    
    })();
    ```
    
    The `delay` could be configured from a dropdown on the top right corner of 
the page, which is relatively standard in such dashboards.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org
For additional commands, e-mail: reviews-h...@spark.apache.org

Reply via email to