@jupyterlab/running
Advanced tools
Comparing version 3.0.0-beta.4 to 3.0.0-beta.5
@@ -67,2 +67,6 @@ /// <reference types="react" /> | ||
runningChanged: ISignal<any, any>; | ||
shutdownLabel?: string; | ||
shutdownAllLabel?: string; | ||
shutdownAllConfirmationText?: string; | ||
shutdownItemIcon?: LabIcon; | ||
} | ||
@@ -78,3 +82,4 @@ /** | ||
labelTitle?: () => string; | ||
detail?: () => string; | ||
} | ||
} |
@@ -42,5 +42,13 @@ // Copyright (c) Jupyter Development Team. | ||
/** | ||
* The class name added to a running session item detail. | ||
*/ | ||
const ITEM_DETAIL_CLASS = 'jp-RunningSessions-itemDetail'; | ||
/** | ||
* The class name added to a running session item shutdown button. | ||
*/ | ||
const SHUTDOWN_BUTTON_CLASS = 'jp-RunningSessions-itemShutdown'; | ||
/** | ||
* The class name added to a running session item shutdown button. | ||
*/ | ||
const SHUTDOWN_ALL_BUTTON_CLASS = 'jp-RunningSessions-shutdownAll'; | ||
/* tslint:disable */ | ||
@@ -78,16 +86,21 @@ /** | ||
function Item(props) { | ||
var _a; | ||
const { runningItem } = props; | ||
const icon = runningItem.icon(); | ||
const detail = (_a = runningItem.detail) === null || _a === void 0 ? void 0 : _a.call(runningItem); | ||
const translator = props.translator || nullTranslator; | ||
const trans = translator.load('jupyterlab'); | ||
const icon = runningItem.icon(); | ||
const shutdownLabel = props.shutdownLabel || trans.__('Shut Down'); | ||
const shutdownItemIcon = props.shutdownItemIcon || closeIcon; | ||
return (React.createElement("li", { className: ITEM_CLASS }, | ||
React.createElement(icon.react, { tag: "span", stylesheet: "runningItem" }), | ||
React.createElement("span", { className: ITEM_LABEL_CLASS, title: runningItem.labelTitle ? runningItem.labelTitle() : '', onClick: () => runningItem.open() }, runningItem.label()), | ||
React.createElement("button", { className: `${SHUTDOWN_BUTTON_CLASS} jp-mod-styled`, onClick: () => runningItem.shutdown() }, trans.__('SHUT DOWN')))); | ||
detail && React.createElement("span", { className: ITEM_DETAIL_CLASS }, detail), | ||
React.createElement(ToolbarButtonComponent, { className: SHUTDOWN_BUTTON_CLASS, icon: shutdownItemIcon, onClick: () => runningItem.shutdown(), tooltip: shutdownLabel }))); | ||
} | ||
function ListView(props) { | ||
return (React.createElement("ul", { className: LIST_CLASS }, props.runningItems.map((item, i) => (React.createElement(Item, { key: i, runningItem: item, translator: props.translator || nullTranslator }))))); | ||
return (React.createElement("ul", { className: LIST_CLASS }, props.runningItems.map((item, i) => (React.createElement(Item, { key: i, runningItem: item, shutdownLabel: props.shutdownLabel, shutdownItemIcon: props.shutdownItemIcon, translator: props.translator }))))); | ||
} | ||
function List(props) { | ||
return (React.createElement(UseSignal, { signal: props.manager.runningChanged }, () => (React.createElement(ListView, { runningItems: props.manager.running(), translator: props.translator || nullTranslator })))); | ||
return (React.createElement(UseSignal, { signal: props.manager.runningChanged }, () => (React.createElement(ListView, { runningItems: props.manager.running(), shutdownLabel: props.shutdownLabel, shutdownAllLabel: props.shutdownAllLabel, shutdownItemIcon: props.manager.shutdownItemIcon, translator: props.translator })))); | ||
} | ||
@@ -103,9 +116,13 @@ /** | ||
const trans = translator.load('jupyterlab'); | ||
const shutdownAllLabel = props.manager.shutdownAllLabel || trans.__('Shut Down All'); | ||
const shutdownTitle = `${shutdownAllLabel}?`; | ||
const shutdownAllConfirmationText = props.manager.shutdownAllConfirmationText || | ||
`${shutdownAllLabel} ${props.manager.name}`; | ||
function onShutdown() { | ||
void showDialog({ | ||
title: trans.__('Shut Down All?'), | ||
body: `${props.manager.name}`, | ||
title: shutdownTitle, | ||
body: shutdownAllConfirmationText, | ||
buttons: [ | ||
Dialog.cancelButton({ label: trans.__('Cancel') }), | ||
Dialog.warnButton({ label: trans.__('SHUT DOWN') }) | ||
Dialog.warnButton({ label: shutdownAllLabel }) | ||
] | ||
@@ -122,5 +139,5 @@ }).then(result => { | ||
React.createElement("h2", null, props.manager.name), | ||
React.createElement(ToolbarButtonComponent, { icon: closeIcon, onClick: onShutdown, tooltip: trans.__('Shut Down All…') })), | ||
React.createElement("button", { className: `${SHUTDOWN_ALL_BUTTON_CLASS} jp-mod-styled`, onClick: onShutdown }, shutdownAllLabel)), | ||
React.createElement("div", { className: CONTAINER_CLASS }, | ||
React.createElement(List, { manager: props.manager, translator: props.translator }))))); | ||
React.createElement(List, { manager: props.manager, shutdownLabel: props.manager.shutdownLabel, shutdownAllLabel: shutdownAllLabel, translator: props.translator }))))); | ||
} | ||
@@ -127,0 +144,0 @@ function RunningSessionsComponent(props) { |
{ | ||
"name": "@jupyterlab/running", | ||
"version": "3.0.0-beta.4", | ||
"version": "3.0.0-beta.5", | ||
"description": "JupyterLab - Running Sessions Panel", | ||
@@ -38,5 +38,5 @@ "homepage": "https://github.com/jupyterlab/jupyterlab", | ||
"dependencies": { | ||
"@jupyterlab/apputils": "^3.0.0-beta.4", | ||
"@jupyterlab/translation": "^3.0.0-beta.4", | ||
"@jupyterlab/ui-components": "^3.0.0-beta.4", | ||
"@jupyterlab/apputils": "^3.0.0-beta.5", | ||
"@jupyterlab/translation": "^3.0.0-beta.5", | ||
"@jupyterlab/ui-components": "^3.0.0-beta.5", | ||
"@lumino/coreutils": "^1.5.3", | ||
@@ -55,3 +55,3 @@ "@lumino/disposable": "^1.4.3", | ||
}, | ||
"gitHead": "9b674667bda9fd5d4a05f3e7cc5bcb0433241b71" | ||
"gitHead": "439185945105d122516709749eae7c4f3377a37f" | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
22270
386