##// END OF EJS Templates
Better user experience when kernel isn't found
Jessica B. Hamrick -
Show More
@@ -56,7 +56,11 b' class SessionRootHandler(IPythonHandler):'
56 try:
56 try:
57 model = sm.create_session(name=name, path=path, kernel_name=kernel_name)
57 model = sm.create_session(name=name, path=path, kernel_name=kernel_name)
58 except NoSuchKernel:
58 except NoSuchKernel:
59 raise web.HTTPError(400, "No such kernel: %s" % kernel_name)
59 msg = ("The '%s' kernel is not available. Please pick another "
60 "suitable kernel instead, or install that kernel." % kernel_name)
61 status_msg = 'Kernel not found'
62 msg = dict(full=msg, short=status_msg)
63 raise web.HTTPError(400, json.dumps(msg))
60
64
61 location = url_path_join(self.base_url, 'api', 'sessions', model['id'])
65 location = url_path_join(self.base_url, 'api', 'sessions', model['id'])
62 self.set_header('Location', url_escape(location))
66 self.set_header('Location', url_escape(location))
@@ -185,31 +185,21 b' define(['
185 });
185 });
186
186
187 this.events.on('start_failed.Session',function (session, xhr, status, error) {
187 this.events.on('start_failed.Session',function (session, xhr, status, error) {
188 var msg = $('<div/>');
188 var msg = JSON.parse(status.responseJSON.message);
189 msg.append($('<div/>')
190 .text('The kernel could not be started. This might ' +
191 'happen if the notebook was previously run with a kernel ' +
192 'that you do not have installed. Please choose a different kernel, ' +
193 'or install the needed kernel and then refresh this page.')
194 .css('margin-bottom', '1em'));
195
189
196 msg.append($('<div/>')
190 that.save_widget.update_document_title();
197 .text('The exact error was:')
191 $kernel_ind_icon.attr('class','kernel_dead_icon').attr('title','Kernel Dead');
198 .css('margin-bottom', '1em'));
192 knw.danger(msg.short, undefined, function () {
199
193 dialog.modal({
200 msg.append($('<div/>')
194 title: "Failed to start the kernel",
201 .attr('class', 'alert alert-danger')
195 body : msg.full,
202 .attr('role', 'alert')
196 keyboard_manager: that.keyboard_manager,
203 .text(JSON.parse(status.responseText).message));
197 notebook: that.notebook,
204
198 buttons : {
205 dialog.modal({
199 "Ok": { class: 'btn-primary' }
206 title: "Failed to start the kernel",
200 }
207 body : msg,
201 });
208 keyboard_manager: that.keyboard_manager,
202 return false;
209 notebook: that.notebook,
210 buttons : {
211 "Ok": { class: 'btn-primary' }
212 }
213 });
203 });
214 });
204 });
215
205
@@ -112,7 +112,6 b' define(['
112
112
113 Session.prototype._handle_start_failure = function (xhr, status, error) {
113 Session.prototype._handle_start_failure = function (xhr, status, error) {
114 this.events.trigger('start_failed.Session', [this, xhr, status, error]);
114 this.events.trigger('start_failed.Session', [this, xhr, status, error]);
115 this.events.trigger('status_dead.Kernel');
116 };
115 };
117
116
118 /**
117 /**
General Comments 0
You need to be logged in to leave comments. Login now