Skip to content

Commit

Permalink
Add workspace name in the "Delete" tooltip
Browse files Browse the repository at this point in the history
  • Loading branch information
krassowski committed Mar 19, 2024
1 parent bcf8dfc commit 19f3ad8
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
11 changes: 7 additions & 4 deletions packages/running/src/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ export class RunningSessionManagers implements IRunningSessionManagers {
function Item(props: {
child?: boolean;
runningItem: IRunningSessions.IRunningItem;
shutdownLabel?: string;
shutdownLabel?: string | ((item: IRunningSessions.IRunningItem) => string);
shutdownItemIcon?: LabIcon;
translator?: ITranslator;
}) {
Expand All @@ -158,7 +158,10 @@ function Item(props: {
// Handle shutdown requests.
let stopPropagation = false;
const shutdownItemIcon = props.shutdownItemIcon || closeIcon;
const shutdownLabel = props.shutdownLabel || trans.__('Shut Down');
const shutdownLabel =
(typeof props.shutdownLabel === 'function'
? props.shutdownLabel(runningItem)
: props.shutdownLabel) ?? trans.__('Shut Down');
const shutdown = () => {
stopPropagation = true;
runningItem.shutdown?.();
Expand Down Expand Up @@ -232,7 +235,7 @@ function Item(props: {
function List(props: {
child?: boolean;
runningItems: IRunningSessions.IRunningItem[];
shutdownLabel?: string;
shutdownLabel?: string | ((item: IRunningSessions.IRunningItem) => string);
shutdownAllLabel?: string;
shutdownItemIcon?: LabIcon;
translator?: ITranslator;
Expand Down Expand Up @@ -515,7 +518,7 @@ export namespace IRunningSessions {
/**
* A string used to describe the shutdown action.
*/
shutdownLabel?: string;
shutdownLabel?: string | ((item: IRunningSessions.IRunningItem) => string);

/**
* A string used to describe the shutdown all action.
Expand Down
3 changes: 2 additions & 1 deletion packages/workspaces-extension/src/sidebar.ts
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,8 @@ export const workspacesSidebar: JupyterFrontEndPlugin<void> = {
await model.refresh();
},
runningChanged: model.refreshed,
shutdownLabel: trans.__('Delete'),
shutdownLabel: (item: IRunningSessions.IRunningItem) =>
trans.__('Delete %1', item.label() as string),
shutdownAllLabel: trans.__('Delete All'),
shutdownAllConfirmationText: trans.__(
'Are you sure you want to delete all workspaces?'
Expand Down

0 comments on commit 19f3ad8

Please sign in to comment.