@jupyterlab/running
Advanced tools
Comparing version 4.0.0-alpha.20 to 4.0.0-alpha.21
@@ -132,2 +132,62 @@ // Copyright (c) Jupyter Development Team. | ||
} | ||
class ListWidget extends ReactWidget { | ||
constructor(_options) { | ||
super(); | ||
this._options = _options; | ||
this._update = new Signal(this); | ||
_options.manager.runningChanged.connect(this._emitUpdate, this); | ||
} | ||
dispose() { | ||
this._options.manager.runningChanged.disconnect(this._emitUpdate, this); | ||
super.dispose(); | ||
} | ||
onBeforeShow(msg) { | ||
super.onBeforeShow(msg); | ||
this._update.emit(); | ||
} | ||
render() { | ||
const options = this._options; | ||
let cached = true; | ||
return (React.createElement(UseSignal, { signal: this._update }, () => { | ||
// Cache the running items for the intial load and request from | ||
// the service every subsequent load. | ||
if (cached) { | ||
cached = false; | ||
} | ||
else { | ||
options.runningItems = options.manager.running(); | ||
} | ||
return (React.createElement("div", { className: CONTAINER_CLASS }, | ||
React.createElement(List, { runningItems: options.runningItems, shutdownLabel: options.manager.shutdownLabel, shutdownAllLabel: options.shutdownAllLabel, shutdownItemIcon: options.manager.shutdownItemIcon, translator: options.translator }))); | ||
})); | ||
} | ||
/** | ||
* Check if the widget or any of it's parents is hidden. | ||
* | ||
* Checking parents is necessary as lumino does not propagate visibility | ||
* changes from parents down to children (although it does notify parents | ||
* about changes to children visibility). | ||
*/ | ||
_isAnyHidden() { | ||
let isHidden = this.isHidden; | ||
if (isHidden) { | ||
return isHidden; | ||
} | ||
let parent = this.parent; | ||
while (parent != null) { | ||
if (parent.isHidden) { | ||
isHidden = true; | ||
break; | ||
} | ||
parent = parent.parent; | ||
} | ||
return isHidden; | ||
} | ||
_emitUpdate() { | ||
if (this._isAnyHidden()) { | ||
return; | ||
} | ||
this._update.emit(); | ||
} | ||
} | ||
/** | ||
@@ -166,3 +226,2 @@ * The Section component contains the shared look and feel for an interactive | ||
let runningItems = options.manager.running(); | ||
let cached = true; | ||
const enabled = runningItems.length > 0; | ||
@@ -177,14 +236,3 @@ this._button = new ToolbarButton({ | ||
this.toolbar.addItem('shutdown-all', this._button); | ||
this.addWidget(ReactWidget.create(React.createElement(UseSignal, { signal: options.manager.runningChanged }, () => { | ||
// Cache the running items for the intial load and request from | ||
// the service every subsequent load. | ||
if (cached) { | ||
cached = false; | ||
} | ||
else { | ||
runningItems = options.manager.running(); | ||
} | ||
return (React.createElement("div", { className: CONTAINER_CLASS }, | ||
React.createElement(List, { runningItems: runningItems, shutdownLabel: options.manager.shutdownLabel, shutdownAllLabel: shutdownAllLabel, shutdownItemIcon: options.manager.shutdownItemIcon, translator: options.translator }))); | ||
}))); | ||
this.addWidget(new ListWidget({ runningItems, shutdownAllLabel, ...options })); | ||
} | ||
@@ -191,0 +239,0 @@ /** |
{ | ||
"name": "@jupyterlab/running", | ||
"version": "4.0.0-alpha.20", | ||
"version": "4.0.0-alpha.21", | ||
"description": "JupyterLab - Running Sessions Panel", | ||
@@ -40,8 +40,10 @@ "homepage": "https://github.com/jupyterlab/jupyterlab", | ||
"dependencies": { | ||
"@jupyterlab/apputils": "^4.0.0-alpha.20", | ||
"@jupyterlab/translation": "^4.0.0-alpha.20", | ||
"@jupyterlab/ui-components": "^4.0.0-alpha.35", | ||
"@lumino/coreutils": "^2.0.0-rc.0", | ||
"@lumino/disposable": "^2.0.0-rc.0", | ||
"@lumino/signaling": "^2.0.0-rc.0", | ||
"@jupyterlab/apputils": "^4.0.0-alpha.21", | ||
"@jupyterlab/translation": "^4.0.0-alpha.21", | ||
"@jupyterlab/ui-components": "^4.0.0-alpha.36", | ||
"@lumino/coreutils": "^2.0.0-rc.1", | ||
"@lumino/disposable": "^2.0.0-rc.1", | ||
"@lumino/messaging": "^2.0.0-rc.1", | ||
"@lumino/signaling": "^2.0.0-rc.1", | ||
"@lumino/widgets": "^2.0.0-rc.1", | ||
"react": "^18.2.0" | ||
@@ -52,3 +54,3 @@ }, | ||
"typedoc": "~0.23.25", | ||
"typescript": "~5.0.0-beta" | ||
"typescript": "~5.0.1-rc" | ||
}, | ||
@@ -55,0 +57,0 @@ "publishConfig": { |
@@ -7,2 +7,3 @@ /*----------------------------------------------------------------------------- | ||
/* This file was auto-generated by ensurePackage() in @jupyterlab/buildutils */ | ||
import '@lumino/widgets/style/index.js'; | ||
import '@jupyterlab/ui-components/style/index.js'; | ||
@@ -9,0 +10,0 @@ import '@jupyterlab/apputils/style/index.js'; |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
46273
1116
9
1
+ Added@lumino/widgets@^2.0.0-rc.1