show message on notebook list if server is unreachable

usefull when :
server goes down, you don't notice it on dashboard

restart on https, cookies is unvalid, autoreload don't work
pull/37/head
Matthias BUSSONNIER 14 years ago
parent aaf911c5e5
commit 23cf94023d

@ -88,19 +88,23 @@ var IPython = (function (IPython) {
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 +113,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