Skip to content

Toolbar kernel actions buttons #94

Open
@DenisaCG

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);
}
});

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