Skip to content

Toolbar kernel actions buttons #94

Description

@DenisaCG

The toolbar buttons for the kernel actions can be added, so it's easier for users to access them.

Screenshot from 2024-08-20 11-50-11

Currently the actions are only present inside the Kernel Menu. The commands are defined here:

// Register kernel commands.
commands.addCommand(CommandIDs.interruptKernel, {
label: 'Interrupt Kernel',
execute: args => {
const current = getCurrent(args);
if (!current) {
return;
}
const kernel = current.context.sessionContext.session?.kernel;
if (kernel) {
return kernel.interrupt();
}
return Promise.resolve(void 0);
},
isEnabled
});
commands.addCommand(CommandIDs.restartKernel, {
label: 'Restart Kernel…',
execute: args => {
const current = getCurrent(args);
if (!current) {
return;
}
const kernel = current.context.sessionContext.session?.kernel;
if (kernel) {
return kernel.restart();
}
return Promise.resolve(void 0);
},
isEnabled
});
commands.addCommand(CommandIDs.shutdownKernel, {
label: 'Shut Down Kernel',
execute: args => {
const current = getCurrent(args);
if (!current) {
return;
}
return current.context.sessionContext.shutdown();
}
});
commands.addCommand(CommandIDs.reconnectToKernel, {
label: 'Reconnect to Kernel',
execute: args => {
const current = getCurrent(args);
if (!current) {
return;
}
const kernel = current.context.sessionContext.session?.kernel;
if (kernel) {
return kernel.reconnect();
}
return Promise.resolve(void 0);
}
});

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions