Well, that fixed it; I was just missing the "click" method keyword.

For anyone who finds it helpful, here it is:


*Notebook Halt / Restart cell*

 

When included at the bottom of a notebook, it will stop the notebook at the 
end of Run All, and pop up a modal dialog letting the user know that the 
notebook was auto-stopped at the end of the run. The dialog offers a 
"Kernel Restart" button which restarts the notebook.



%%javascript
require(
    ["base/js/dialog"], 
    function(dialog) {
        dialog.modal({
                title: 'Notebook Halted',
                body: 'This notebook is no longer running; the kernel has 
been halted. Close the browser tab, or, to continue working, restart the 
kernel.',
                buttons: {
                    'Kernel restart': { click: function(){ Jupyter.notebook.
session.restart(); } }
                }
        });
    }
);
Jupyter.notebook.session.delete();




On Tuesday, November 15, 2016 at 6:11:59 PM UTC-8, Jeremy Douglass wrote:
>
> Ah -- I am using the regular notebook, not jupyterlab, so it looks like I 
> was looking in the wrong place. Thank you for the link -- that looks really 
> promising:
>
>
> https://github.com/jupyter/notebook/blob/master/notebook/static/base/js/dialog.js#L191
>
>
> On Tuesday, November 15, 2016 at 3:16:03 PM UTC-8, takowl wrote:
>>
>> On 15 November 2016 at 14:03, Jeremy Douglass <[email protected]> 
>> wrote:
>>
>>> I *believe* I found the modal dialog:
>>>
>>>    - https://github.com/jupyter-attic/jupyter-js-filebrowser/pull/13
>>>    - https://github.com/jupyter-attic/jupyter-js-filebrowser/issues/12
>>>    - https://github.com/phosphorjs/phosphor-dialog
>>>    
>>> ...however github linked API is missing.
>>>
>>>    - http://phosphorjs.github.io/phosphor-dialog/api/
>>>
>>>
>> Are you using Jupyterlab or the existing notebook? Those APIs are all 
>> part of Jupyterlab (the in-development new notebook interface). The 
>> existing interface has modal dialogs built with jquery and bootstrap, I 
>> think:
>>
>>
>> https://github.com/jupyter/notebook/blob/master/notebook/static/base/js/dialog.js
>>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Project Jupyter" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jupyter/c524cdd2-14b1-422f-8636-162d6ebc03e9%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to