Show More
@@ -90,6 +90,15 define([ | |||||
90 | return modal.modal(options); |
|
90 | return modal.modal(options); | |
91 | }; |
|
91 | }; | |
92 |
|
92 | |||
|
93 | var kernel_modal = function (options) { | |||
|
94 | // only one kernel dialog should be open at a time -- but | |||
|
95 | // other modal dialogs can still be open | |||
|
96 | $('.kernel-modal').modal('hide'); | |||
|
97 | var dialog = modal(options); | |||
|
98 | dialog.addClass('kernel-modal'); | |||
|
99 | return dialog; | |||
|
100 | }; | |||
|
101 | ||||
93 | var edit_metadata = function (options) { |
|
102 | var edit_metadata = function (options) { | |
94 | options.name = options.name || "Cell"; |
|
103 | options.name = options.name || "Cell"; | |
95 | var error_div = $('<div/>').css('color', 'red'); |
|
104 | var error_div = $('<div/>').css('color', 'red'); | |
@@ -153,6 +162,7 define([ | |||||
153 |
|
162 | |||
154 | var dialog = { |
|
163 | var dialog = { | |
155 | modal : modal, |
|
164 | modal : modal, | |
|
165 | kernel_modal : kernel_modal, | |||
156 | edit_metadata : edit_metadata, |
|
166 | edit_metadata : edit_metadata, | |
157 | }; |
|
167 | }; | |
158 |
|
168 |
@@ -149,10 +149,7 define([ | |||||
149 | // times it tries restarting). |
|
149 | // times it tries restarting). | |
150 | if (info.attempt === 1) { |
|
150 | if (info.attempt === 1) { | |
151 |
|
151 | |||
152 | // hide existing modal dialog |
|
152 | dialog.kernel_modal({ | |
153 | $(".modal").modal('hide'); |
|
|||
154 |
|
||||
155 | dialog.modal({ |
|
|||
156 | notebook: that.notebook, |
|
153 | notebook: that.notebook, | |
157 | keyboard_manager: that.keyboard_manager, |
|
154 | keyboard_manager: that.keyboard_manager, | |
158 | title: "Kernel Restarting", |
|
155 | title: "Kernel Restarting", | |
@@ -186,15 +183,13 define([ | |||||
186 | // trying to reconnect and we don't want to spam the user |
|
183 | // trying to reconnect and we don't want to spam the user | |
187 | // with messages |
|
184 | // with messages | |
188 | if (info.attempt === 1) { |
|
185 | if (info.attempt === 1) { | |
189 | // hide existing dialog |
|
|||
190 | $(".modal").modal('hide'); |
|
|||
191 |
|
186 | |||
192 | var msg = "A connection to the notebook server could not be established." + |
|
187 | var msg = "A connection to the notebook server could not be established." + | |
193 | " The notebook will continue trying to reconnect, but" + |
|
188 | " The notebook will continue trying to reconnect, but" + | |
194 | " until it does, you will NOT be able to run code. Check your" + |
|
189 | " until it does, you will NOT be able to run code. Check your" + | |
195 | " network connection or notebook server configuration."; |
|
190 | " network connection or notebook server configuration."; | |
196 |
|
191 | |||
197 | dialog.modal({ |
|
192 | dialog.kernel_modal({ | |
198 | title: "Connection failed", |
|
193 | title: "Connection failed", | |
199 | body: msg, |
|
194 | body: msg, | |
200 | keyboard_manager: that.keyboard_manager, |
|
195 | keyboard_manager: that.keyboard_manager, | |
@@ -215,8 +210,6 define([ | |||||
215 | this.events.on('kernel_dead.Kernel', function () { |
|
210 | this.events.on('kernel_dead.Kernel', function () { | |
216 |
|
211 | |||
217 | var showMsg = function () { |
|
212 | var showMsg = function () { | |
218 | // hide existing dialog |
|
|||
219 | $(".modal").modal('hide'); |
|
|||
220 |
|
213 | |||
221 | var msg = 'The kernel has died, and the automatic restart has failed.' + |
|
214 | var msg = 'The kernel has died, and the automatic restart has failed.' + | |
222 | ' It is possible the kernel cannot be restarted.' + |
|
215 | ' It is possible the kernel cannot be restarted.' + | |
@@ -224,7 +217,7 define([ | |||||
224 | ' the notebook, but running code will no longer work until the notebook' + |
|
217 | ' the notebook, but running code will no longer work until the notebook' + | |
225 | ' is reopened.'; |
|
218 | ' is reopened.'; | |
226 |
|
219 | |||
227 | dialog.modal({ |
|
220 | dialog.kernel_modal({ | |
228 | title: "Dead kernel", |
|
221 | title: "Dead kernel", | |
229 | body : msg, |
|
222 | body : msg, | |
230 | keyboard_manager: that.keyboard_manager, |
|
223 | keyboard_manager: that.keyboard_manager, | |
@@ -273,10 +266,7 define([ | |||||
273 | cm_open = $.proxy(cm.refresh, cm); |
|
266 | cm_open = $.proxy(cm.refresh, cm); | |
274 | } |
|
267 | } | |
275 |
|
268 | |||
276 | // hide existing modal dialog |
|
269 | dialog.kernel_modal({ | |
277 | $(".modal").modal('hide'); |
|
|||
278 |
|
||||
279 | dialog.modal({ |
|
|||
280 | title: "Failed to start the kernel", |
|
270 | title: "Failed to start the kernel", | |
281 | body : msg, |
|
271 | body : msg, | |
282 | keyboard_manager: that.keyboard_manager, |
|
272 | keyboard_manager: that.keyboard_manager, |
General Comments 0
You need to be logged in to leave comments.
Login now