Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Notify the user of errors when saving a notebook.

  • Loading branch information...
commit 294bd095153888fdd88b2e0b48be1ecc94afb099 1 parent b13f5a5
@fwerner fwerner authored
View
11 IPython/frontend/html/notebook/static/js/notebook.js
@@ -871,7 +871,8 @@ var IPython = (function (IPython) {
type : "PUT",
data : JSON.stringify(data),
headers : {'Content-Type': 'application/json'},
- success : $.proxy(this.notebook_saved,this)
+ success : $.proxy(this.notebook_saved,this),
+ error : $.proxy(this.notebook_save_failed,this)
};
IPython.save_widget.status_saving();
$.ajax("/notebooks/" + notebook_id, settings);
@@ -886,6 +887,14 @@ var IPython = (function (IPython) {
}
+ Notebook.prototype.notebook_save_failed = function (xhr, status, error_msg) {
+ // Notify the user and reset the save button
+ // TODO: Handle different types of errors (timeout etc.)
+ alert('An unexpected error occured while saving the notebook.');
+ setTimeout($.proxy(IPython.save_widget.reset_status,IPython.save_widget),500);
+ }
+
+
Notebook.prototype.load_notebook = function (callback) {
var that = this;
var notebook_id = IPython.save_widget.get_notebook_id();
View
5 IPython/frontend/html/notebook/static/js/savewidget.js
@@ -115,6 +115,11 @@ var IPython = (function (IPython) {
};
+ SaveWidget.prototype.reset_status = function () {
+ this.is_renaming();
+ };
+
+
SaveWidget.prototype.status_save = function () {
this.element.find('button#save_notebook').button('option', 'label', '<u>S</u>ave');
this.element.find('button#save_notebook').button('enable');
Please sign in to comment.
Something went wrong with that request. Please try again.