prevent autorefresh when pending upload

don't clear list if 'upload' button are present to avoid clearing the
list and the upload form
This commit is contained in:
Matthias BUSSONNIER 2012-05-06 13:42:35 +02:00
parent a6f78c90b3
commit 13cf61912b
2 changed files with 14 additions and 4 deletions

View File

@ -260,6 +260,7 @@ var IPython = (function (IPython) {
var that = this;
var new_buttons = $('<span/>').addClass('item_buttons');
var upload_button = $('<button>Upload</button>').button().
addClass('upload-button').
click(function (e) {
var nbname = item.find('.item_name > input').attr('value');
var nbformat = item.data('nbformat');

View File

@ -37,12 +37,18 @@ $(document).ready(function () {
var enable_autorefresh = function(){
//refresh immediately , then start interval
IPython.notebook_list.load_list();
IPython.cluster_list.load_list();
if($('upload_button').length == 0)
{
IPython.notebook_list.load_list();
IPython.cluster_list.load_list();
}
if (!interval_id){
interval_id = setInterval(function(){
IPython.notebook_list.load_list();
IPython.cluster_list.load_list();
if($('upload_button').length == 0)
{
IPython.notebook_list.load_list();
IPython.cluster_list.load_list();
}
}, time_refresh*1000);
}
}
@ -65,6 +71,9 @@ $(document).ready(function () {
// finally start it, it will refresh immediately
enable_autorefresh();
IPython.enable_autorefresh = enable_autorefresh;
IPython.disable_autorefresh = disable_autorefresh;
IPython.page.show();
// bound the upload method to the on change of the file select list