Merge pull request #2159 from Carreau/dashbord_refresh_on_error

show message on notebook list if server is unreachable
Bussonnier Matthias 14 years ago
commit 260a107d80

@ -84,23 +84,29 @@ var IPython = (function (IPython) {
NotebookList.prototype.clear_list = function () {
this.element.children('.list_item').remove();
}
};
NotebookList.prototype.load_list = function () {
var that = this;
var settings = {
processData : false,
cache : false,
type : "GET",
dataType : "json",
success : $.proxy(this.list_loaded, this)
success : $.proxy(this.list_loaded, this),
error : $.proxy( function(){
that.list_loaded([], null, null, {msg:"Error connecting to server."});
},this)
};
var url = $('body').data('baseProjectUrl') + 'notebooks';
$.ajax(url, settings);
};
NotebookList.prototype.list_loaded = function (data, status, xhr) {
NotebookList.prototype.list_loaded = function (data, status, xhr, param) {
var message = param.msg || 'Notebook list empty.';
var len = data.length;
this.clear_list();
@ -109,7 +115,7 @@ var IPython = (function (IPython) {
$(this.new_notebook_item(0))
.append(
$('<div style="margin:auto;text-align:center;color:grey"/>')
.text('Notebook list empty.')
.text(message)
)
}

Loading…
Cancel
Save