New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Make session dialogs configurable #7618
Conversation
Thanks for making a pull request to JupyterLab! To try out this branch on binder, follow this link: |
3c847c8
to
51eada0
Compare
Unfortunately, needs rebase. |
@@ -51,7 +51,7 @@ export interface ISessionContext extends IObservableDisposable { | |||
* #### Notes | |||
* This includes starting up an initial kernel if needed. | |||
*/ | |||
initialize(): Promise<void>; | |||
initialize(): Promise<boolean>; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should there be a docstring that says what this boolean
is?
@@ -531,7 +534,8 @@ function activateNotebookHandler( | |||
launcher: ILauncher | null, | |||
restorer: ILayoutRestorer | null, | |||
mainMenu: IMainMenu | null, | |||
settingRegistry: ISettingRegistry | null | |||
settingRegistry: ISettingRegistry | null, | |||
sessionDialogs: ISessionContextDialogs |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing | null
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks good, but a second opinion would probably be beneficial.
👍
@@ -732,7 +698,7 @@ export class SessionContext implements ISessionContext { | |||
this._session.dispose(); | |||
} | |||
this._session = session; | |||
this._prevKernelName = session.kernel?.name; | |||
this._prevKernelName = session.kernel?.name || ''; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
?? ''
packages/apputils/src/toolbar.tsx
Outdated
return new ToolbarButton({ | ||
iconClassName: 'jp-RefreshIcon', | ||
onClick: () => { | ||
void sessionContext.restart(); | ||
void (dialogs || sessionContextDialogs).restart(sessionContext); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
dialogs ?? sessionContextDialogs
packages/apputils/src/toolbar.tsx
Outdated
<Private.KernelNameComponent sessionContext={sessionContext} /> | ||
<Private.KernelNameComponent | ||
sessionContext={sessionContext} | ||
dialogs={dialogs || sessionContextDialogs} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
dialogs ??
): Promise<IConsoleTracker> { | ||
const manager = app.serviceManager; | ||
const { commands, shell } = app; | ||
const category = 'Console'; | ||
sessionDialogs = sessionDialogs || sessionContextDialogs; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
||
-> ??
@@ -136,11 +138,13 @@ async function activateConsole( | |||
rendermime: IRenderMimeRegistry, | |||
settingRegistry: ISettingRegistry, | |||
launcher: ILauncher | null, | |||
status: ILabStatus | null | |||
status: ILabStatus | null, | |||
sessionDialogs: ISessionContextDialogs | null |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you could just make this have a default value: sessionDialogs = sessionContextDialogs
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
wait, no, that won't work if null
is explicitly being passed in...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If the supplied value is null
I believe that wouldn't work
This looks pretty good to me reading through it. I had a couple of suggestions, but nothing that would block this (but apparently you've already addressed them, so yeah). The test failure looks legit. |
lint update notebook example offer the option to keep no kernel integrity lint fix up merge conflicts lint update tests Update tests Select a kernel if necessary in the console
c10e258
to
92d1dc0
Compare
Weird, the issues with the linux usage test went away after a rebase. |
References
Fixes #7616.
Code changes
ISessionContext
to no longer contain any UI.ISessionContextDialogs
interface and tokenrestart
andselectKernel
dialogs.User-facing changes
None
Backwards-incompatible changes
ISessionContext
no longer hasrestart()
orselectKernel()
methods.ISessionContext
should allow the dialogs to be overridden and ultimately depend on theISessionContextDialogs
token.selectKernel()
dialog ifinitialize()
resolves totrue
.