##// END OF EJS Templates
dashboard autorefresh...
Matthias BUSSONNIER -
Show More
@@ -30,8 +30,41 b' $(document).ready(function () {'
30 30 IPython.cluster_list = new IPython.ClusterList('div#cluster_list');
31 31 IPython.login_widget = new IPython.LoginWidget('span#login_widget');
32 32
33 IPython.notebook_list.load_list();
34 IPython.cluster_list.load_list();
33 var interval_id=0;
34 // auto refresh every xx secondes, no need to be fast,
35 // update is done at least when page get focus
36 var time_refresh = 60; // in sec
37
38 var enable_autorefresh = function(){
39 //refresh immediately , then start interval
40 IPython.notebook_list.load_list();
41 IPython.cluster_list.load_list();
42 if (!interval_id){
43 interval_id = setInterval(function(){
44 IPython.notebook_list.load_list();
45 IPython.cluster_list.load_list();
46 }, time_refresh*1000);
47 }
48 }
49
50 var disable_autorefresh = function(){
51 clearInterval(interval_id);
52 interval_id = 0;
53 }
54
55 // stop autorefresh when page lose focus
56 $(window).blur(function() {
57 disable_autorefresh();
58 })
59
60 //re-enable when page get focus back
61 $(window).focus(function() {
62 enable_autorefresh();
63 });
64
65 // finally start it, it will refresh immediately
66 enable_autorefresh();
67
35 68 IPython.page.show();
36 69
37 70 // bound the upload method to the on change of the file select list
General Comments 0
You need to be logged in to leave comments. Login now