Skip to content
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

Show kernel ID for notebooks and consoles in list view #16228

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
20 changes: 14 additions & 6 deletions packages/running-extension/src/kernels.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,6 @@ namespace Private {
const { _name, spec } = this;
return spec?.display_name || _name;
}

get children(): IRunningSessions.IRunningItem[] {
return this._kernels;
}
Expand All @@ -239,7 +238,7 @@ namespace Private {
type DocumentWidgetWithKernelItem = Omit<
IRunningSessions.IRunningItem,
'label'
> & { label(): string };
> & { label(): ReactNode; name(): string };

export class RunningKernel implements IRunningSessions.IRunningItem {
constructor(options: RunningKernel.IOptions) {
Expand Down Expand Up @@ -283,8 +282,17 @@ namespace Private {
: type === 'notebook'
? notebookIcon
: jupyterIcon,
label: () => name,
labelTitle: () => path
label: () => {
const kernelIdPrefix = this.kernel.id.split('-')[0];
return (
<>
{name}{' '}
<span className={KERNEL_LABEL_ID}>({kernelIdPrefix})</span>
</>
);
},
labelTitle: () => path,
name: () => name
});
}
}
Expand Down Expand Up @@ -328,11 +336,11 @@ namespace Private {
if (children.length === 0) {
return this.trans.__('No sessions connected');
} else if (children.length == 1) {
return children[0].label();
return children[0].name();
} else {
return this.trans.__(
'%1 and %2 more',
children[0].label(),
children[0].name(),
children.length - 1
);
}
Expand Down
10 changes: 10 additions & 0 deletions packages/running/style/base.css
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,16 @@
padding-left: 14px;
}

.jp-mod-kernel-widget .jp-RunningSessions-item-label-kernel-id {
display: none;
}

.jp-mod-running-list-view
.jp-mod-kernel-widget
.jp-RunningSessions-item-label-kernel-id {
display: inline;
}

.jp-RunningSessions-item {
display: flex;
flex-direction: row;
Expand Down