Skip to content

Commit

Permalink
Distinguish between notebook/console in starred
Browse files Browse the repository at this point in the history
  • Loading branch information
krassowski committed May 6, 2024
1 parent 35a629f commit 58c32ce
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 11 deletions.
13 changes: 13 additions & 0 deletions src/components/table.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ export function KernelTable(props: {
query: string;
onClick: (item: IKernelItem) => void;
hideColumns?: string[];
showWidgetType?: boolean;
}) {
const { trans } = props;
let query: string;
Expand Down Expand Up @@ -121,6 +122,18 @@ export function KernelTable(props: {
}
);

if (props.showWidgetType) {
extraColumns.push({
id: 'widget-type',
label: trans.__('Type'),
renderCell: (row: IKernelItem) => {
return row.command.split(':')[0];
},
sort: (a: IKernelItem, b: IKernelItem) =>
a.command.localeCompare(b.command)
});
}

const availableColumns: Table.IColumn<IKernelItem>[] = [
{
id: 'kernel',
Expand Down
29 changes: 18 additions & 11 deletions src/launcher.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,10 @@ function LauncherBody(props: {
}
}

const starred = [...props.notebookItems, ...props.consoleItems].filter(
item => item.starred
);

return (
<div className="jp-LauncherBody">
<div className="jp-NewLauncher-TopBar">
Expand Down Expand Up @@ -130,17 +134,20 @@ function LauncherBody(props: {
icon={starIcon}
open={true} // TODO: store this in layout/state higher up
>
<KernelTable
items={[...props.notebookItems, ...props.consoleItems].filter(
item => item.starred
)}
commands={props.commands}
showSearchBox={false}
query={query}
settings={props.settings}
trans={trans}
onClick={item => item.execute()}
/>
{starred.length > 0 ? (
<KernelTable
items={starred}
commands={props.commands}
showSearchBox={false}
showWidgetType={true}
query={query}
settings={props.settings}
trans={trans}
onClick={item => item.execute()}
/>
) : (
'No starred items'
)}
</CollapsibleSection>
) : null}
<CollapsibleSection
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 58c32ce

Please sign in to comment.