@jupyterlab/running 4.0.0-alpha.9 → 4.0.0-beta.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/index.d.ts CHANGED
@@ -3,7 +3,7 @@
3
3
  * @module running
4
4
  */
5
5
  import { ITranslator } from '@jupyterlab/translation';
6
- import { LabIcon, ReactWidget } from '@jupyterlab/ui-components';
6
+ import { LabIcon, SidePanel } from '@jupyterlab/ui-components';
7
7
  import { Token } from '@lumino/coreutils';
8
8
  import { IDisposable } from '@lumino/disposable';
9
9
  import { ISignal } from '@lumino/signaling';
@@ -22,12 +22,20 @@ export interface IRunningSessionManagers {
22
22
  *
23
23
  */
24
24
  add(manager: IRunningSessions.IManager): IDisposable;
25
+ /**
26
+ * Signal emitted when a new manager is added.
27
+ */
28
+ added: ISignal<IRunningSessionManagers, IRunningSessions.IManager>;
25
29
  /**
26
30
  * Return an array of managers.
27
31
  */
28
32
  items(): ReadonlyArray<IRunningSessions.IManager>;
29
33
  }
30
34
  export declare class RunningSessionManagers implements IRunningSessionManagers {
35
+ /**
36
+ * Signal emitted when a new manager is added.
37
+ */
38
+ get added(): ISignal<this, IRunningSessions.IManager>;
31
39
  /**
32
40
  * Add a running item manager.
33
41
  *
@@ -39,18 +47,29 @@ export declare class RunningSessionManagers implements IRunningSessionManagers {
39
47
  * Return an iterator of launcher items.
40
48
  */
41
49
  items(): ReadonlyArray<IRunningSessions.IManager>;
50
+ private _added;
42
51
  private _managers;
43
52
  }
44
53
  /**
45
54
  * A class that exposes the running terminal and kernel sessions.
46
55
  */
47
- export declare class RunningSessions extends ReactWidget {
56
+ export declare class RunningSessions extends SidePanel {
48
57
  /**
49
58
  * Construct a new running widget.
50
59
  */
51
60
  constructor(managers: IRunningSessionManagers, translator?: ITranslator);
52
- protected render(): JSX.Element;
53
- private managers;
61
+ /**
62
+ * Dispose the resources held by the widget
63
+ */
64
+ dispose(): void;
65
+ /**
66
+ * Add a section for a new manager.
67
+ *
68
+ * @param managers Managers
69
+ * @param manager New manager
70
+ */
71
+ protected addSection(_: unknown, manager: IRunningSessions.IManager): void;
72
+ protected managers: IRunningSessionManagers;
54
73
  protected translator: ITranslator;
55
74
  }
56
75
  /**
@@ -61,25 +80,85 @@ export declare namespace IRunningSessions {
61
80
  * A manager of running items grouped under a single section.
62
81
  */
63
82
  interface IManager {
83
+ /**
84
+ * Name that is shown to the user in plural.
85
+ */
64
86
  name: string;
87
+ /**
88
+ * Called when the shutdown all button is pressed.
89
+ */
65
90
  shutdownAll(): void;
91
+ /**
92
+ * List the running models.
93
+ */
66
94
  running(): IRunningItem[];
95
+ /**
96
+ * Force a refresh of the running models.
97
+ */
67
98
  refreshRunning(): void;
99
+ /**
100
+ * A signal that should be emitted when the item list has changed.
101
+ */
68
102
  runningChanged: ISignal<any, any>;
103
+ /**
104
+ * A string used to describe the shutdown action.
105
+ */
69
106
  shutdownLabel?: string;
107
+ /**
108
+ * A string used to describe the shutdown all action.
109
+ */
70
110
  shutdownAllLabel?: string;
111
+ /**
112
+ * A string used as the body text in the shutdown all confirmation dialog.
113
+ */
71
114
  shutdownAllConfirmationText?: string;
115
+ /**
116
+ * The icon to show for shutting down an individual item in this section.
117
+ */
72
118
  shutdownItemIcon?: LabIcon;
73
119
  }
74
120
  /**
75
121
  * A running item.
76
122
  */
77
123
  interface IRunningItem {
78
- open: () => void;
79
- shutdown: () => void;
80
- icon: () => LabIcon;
124
+ /**
125
+ * Optional child nodes that belong to a top-level running item.
126
+ */
127
+ children?: IRunningItem[];
128
+ /**
129
+ * Optional CSS class name to add to the running item.
130
+ */
131
+ className?: string;
132
+ /**
133
+ * Optional context hint to add to the `data-context` attribute of an item.
134
+ */
135
+ context?: string;
136
+ /**
137
+ * Called when the running item is clicked.
138
+ */
139
+ open?: () => void;
140
+ /**
141
+ * Called when the shutdown button is pressed on a particular item.
142
+ */
143
+ shutdown?: () => void;
144
+ /**
145
+ * The `LabIcon` to use as the icon for the running item or the string
146
+ * `src` URL.
147
+ */
148
+ icon: () => LabIcon | string;
149
+ /**
150
+ * Called to determine the label for each item.
151
+ */
81
152
  label: () => string;
153
+ /**
154
+ * Called to determine the `title` attribute for each item, which is
155
+ * revealed on hover.
156
+ */
82
157
  labelTitle?: () => string;
158
+ /**
159
+ * Called to determine the `detail` attribute, which is shown optionally in
160
+ * a column after the label.
161
+ */
83
162
  detail?: () => string;
84
163
  }
85
164
  }
package/lib/index.js CHANGED
@@ -6,26 +6,19 @@
6
6
  */
7
7
  import { Dialog, showDialog } from '@jupyterlab/apputils';
8
8
  import { nullTranslator } from '@jupyterlab/translation';
9
- import { closeIcon, ReactWidget, refreshIcon, ToolbarButtonComponent, UseSignal } from '@jupyterlab/ui-components';
9
+ import { caretDownIcon, caretRightIcon, closeIcon, PanelWithToolbar, ReactWidget, refreshIcon, SidePanel, ToolbarButton, ToolbarButtonComponent, UseSignal } from '@jupyterlab/ui-components';
10
10
  import { Token } from '@lumino/coreutils';
11
11
  import { DisposableDelegate } from '@lumino/disposable';
12
+ import { Signal } from '@lumino/signaling';
12
13
  import * as React from 'react';
13
14
  /**
14
15
  * The class name added to a running widget.
15
16
  */
16
17
  const RUNNING_CLASS = 'jp-RunningSessions';
17
- /**
18
- * The class name added to a running widget header.
19
- */
20
- const HEADER_CLASS = 'jp-RunningSessions-header';
21
18
  /**
22
19
  * The class name added to the running terminal sessions section.
23
20
  */
24
21
  const SECTION_CLASS = 'jp-RunningSessions-section';
25
- /**
26
- * The class name added to the running sessions section header.
27
- */
28
- const SECTION_HEADER_CLASS = 'jp-RunningSessions-sectionHeader';
29
22
  /**
30
23
  * The class name added to a section container.
31
24
  */
@@ -60,8 +53,15 @@ const SHUTDOWN_ALL_BUTTON_CLASS = 'jp-RunningSessions-shutdownAll';
60
53
  export const IRunningSessionManagers = new Token('@jupyterlab/running:IRunningSessionManagers');
61
54
  export class RunningSessionManagers {
62
55
  constructor() {
56
+ this._added = new Signal(this);
63
57
  this._managers = [];
64
58
  }
59
+ /**
60
+ * Signal emitted when a new manager is added.
61
+ */
62
+ get added() {
63
+ return this._added;
64
+ }
65
65
  /**
66
66
  * Add a running item manager.
67
67
  *
@@ -70,6 +70,7 @@ export class RunningSessionManagers {
70
70
  */
71
71
  add(manager) {
72
72
  this._managers.push(manager);
73
+ this._added.emit(manager);
73
74
  return new DisposableDelegate(() => {
74
75
  const i = this._managers.indexOf(manager);
75
76
  if (i > -1) {
@@ -85,25 +86,108 @@ export class RunningSessionManagers {
85
86
  }
86
87
  }
87
88
  function Item(props) {
88
- var _a;
89
+ var _a, _b;
89
90
  const { runningItem } = props;
90
- const icon = runningItem.icon();
91
+ const classList = [ITEM_CLASS];
91
92
  const detail = (_a = runningItem.detail) === null || _a === void 0 ? void 0 : _a.call(runningItem);
93
+ const icon = runningItem.icon();
94
+ const title = runningItem.labelTitle ? runningItem.labelTitle() : '';
92
95
  const translator = props.translator || nullTranslator;
93
96
  const trans = translator.load('jupyterlab');
94
- const shutdownLabel = props.shutdownLabel || trans.__('Shut Down');
97
+ // Handle shutdown requests.
98
+ let stopPropagation = false;
95
99
  const shutdownItemIcon = props.shutdownItemIcon || closeIcon;
96
- return (React.createElement("li", { className: ITEM_CLASS },
97
- React.createElement(icon.react, { tag: "span", stylesheet: "runningItem" }),
98
- React.createElement("span", { className: ITEM_LABEL_CLASS, title: runningItem.labelTitle ? runningItem.labelTitle() : '', onClick: () => runningItem.open() }, runningItem.label()),
99
- detail && React.createElement("span", { className: ITEM_DETAIL_CLASS }, detail),
100
- React.createElement(ToolbarButtonComponent, { className: SHUTDOWN_BUTTON_CLASS, icon: shutdownItemIcon, onClick: () => runningItem.shutdown(), tooltip: shutdownLabel })));
101
- }
102
- function ListView(props) {
103
- 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 })))));
100
+ const shutdownLabel = props.shutdownLabel || trans.__('Shut Down');
101
+ const shutdown = () => {
102
+ var _a;
103
+ stopPropagation = true;
104
+ (_a = runningItem.shutdown) === null || _a === void 0 ? void 0 : _a.call(runningItem);
105
+ };
106
+ // Manage collapsed state. Use the shutdown flag in lieu of `stopPropagation`.
107
+ const [collapsed, collapse] = React.useState(false);
108
+ const collapsible = !!((_b = runningItem.children) === null || _b === void 0 ? void 0 : _b.length);
109
+ const onClick = collapsible
110
+ ? () => !stopPropagation && collapse(!collapsed)
111
+ : undefined;
112
+ if (runningItem.className) {
113
+ classList.push(runningItem.className);
114
+ }
115
+ if (props.child) {
116
+ classList.push('jp-mod-running-child');
117
+ }
118
+ return (React.createElement(React.Fragment, null,
119
+ React.createElement("li", null,
120
+ React.createElement("div", { className: classList.join(' '), onClick: onClick, "data-context": runningItem.context || '' },
121
+ collapsible &&
122
+ (collapsed ? (React.createElement(caretRightIcon.react, { tag: "span", stylesheet: "runningItem" })) : (React.createElement(caretDownIcon.react, { tag: "span", stylesheet: "runningItem" }))),
123
+ typeof icon === 'string' ? (icon ? (React.createElement("img", { src: icon })) : undefined) : (React.createElement(icon.react, { tag: "span", stylesheet: "runningItem" })),
124
+ React.createElement("span", { className: ITEM_LABEL_CLASS, title: title, onClick: runningItem.open && (() => runningItem.open()) }, runningItem.label()),
125
+ detail && React.createElement("span", { className: ITEM_DETAIL_CLASS }, detail),
126
+ runningItem.shutdown && (React.createElement(ToolbarButtonComponent, { className: SHUTDOWN_BUTTON_CLASS, icon: shutdownItemIcon, onClick: shutdown, tooltip: shutdownLabel }))),
127
+ collapsible && !collapsed && (React.createElement(List, { child: true, runningItems: runningItem.children, shutdownItemIcon: shutdownItemIcon, translator: translator })))));
104
128
  }
105
129
  function List(props) {
106
- 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 }))));
130
+ return (React.createElement("ul", { className: LIST_CLASS }, props.runningItems.map((item, i) => (React.createElement(Item, { child: props.child, key: i, runningItem: item, shutdownLabel: props.shutdownLabel, shutdownItemIcon: props.shutdownItemIcon, translator: props.translator })))));
131
+ }
132
+ class ListWidget extends ReactWidget {
133
+ constructor(_options) {
134
+ super();
135
+ this._options = _options;
136
+ this._update = new Signal(this);
137
+ _options.manager.runningChanged.connect(this._emitUpdate, this);
138
+ }
139
+ dispose() {
140
+ this._options.manager.runningChanged.disconnect(this._emitUpdate, this);
141
+ super.dispose();
142
+ }
143
+ onBeforeShow(msg) {
144
+ super.onBeforeShow(msg);
145
+ this._update.emit();
146
+ }
147
+ render() {
148
+ const options = this._options;
149
+ let cached = true;
150
+ return (React.createElement(UseSignal, { signal: this._update }, () => {
151
+ // Cache the running items for the intial load and request from
152
+ // the service every subsequent load.
153
+ if (cached) {
154
+ cached = false;
155
+ }
156
+ else {
157
+ options.runningItems = options.manager.running();
158
+ }
159
+ return (React.createElement("div", { className: CONTAINER_CLASS },
160
+ React.createElement(List, { runningItems: options.runningItems, shutdownLabel: options.manager.shutdownLabel, shutdownAllLabel: options.shutdownAllLabel, shutdownItemIcon: options.manager.shutdownItemIcon, translator: options.translator })));
161
+ }));
162
+ }
163
+ /**
164
+ * Check if the widget or any of it's parents is hidden.
165
+ *
166
+ * Checking parents is necessary as lumino does not propagate visibility
167
+ * changes from parents down to children (although it does notify parents
168
+ * about changes to children visibility).
169
+ */
170
+ _isAnyHidden() {
171
+ let isHidden = this.isHidden;
172
+ if (isHidden) {
173
+ return isHidden;
174
+ }
175
+ let parent = this.parent;
176
+ while (parent != null) {
177
+ if (parent.isHidden) {
178
+ isHidden = true;
179
+ break;
180
+ }
181
+ parent = parent.parent;
182
+ }
183
+ return isHidden;
184
+ }
185
+ _emitUpdate() {
186
+ if (this._isAnyHidden()) {
187
+ return;
188
+ }
189
+ this._update.emit();
190
+ }
107
191
  }
108
192
  /**
109
193
  * The Section component contains the shared look and feel for an interactive
@@ -111,62 +195,105 @@ function List(props) {
111
195
  *
112
196
  * It is specialized for each based on its props.
113
197
  */
114
- function Section(props) {
115
- const translator = props.translator || nullTranslator;
116
- const trans = translator.load('jupyterlab');
117
- const shutdownAllLabel = props.manager.shutdownAllLabel || trans.__('Shut Down All');
118
- const shutdownTitle = `${shutdownAllLabel}?`;
119
- const shutdownAllConfirmationText = props.manager.shutdownAllConfirmationText ||
120
- `${shutdownAllLabel} ${props.manager.name}`;
121
- function onShutdown() {
122
- void showDialog({
123
- title: shutdownTitle,
124
- body: shutdownAllConfirmationText,
125
- buttons: [
126
- Dialog.cancelButton({ label: trans.__('Cancel') }),
127
- Dialog.warnButton({ label: shutdownAllLabel })
128
- ]
129
- }).then(result => {
130
- if (result.button.accept) {
131
- props.manager.shutdownAll();
132
- }
198
+ class Section extends PanelWithToolbar {
199
+ constructor(options) {
200
+ super();
201
+ this._manager = options.manager;
202
+ const translator = options.translator || nullTranslator;
203
+ const trans = translator.load('jupyterlab');
204
+ const shutdownAllLabel = options.manager.shutdownAllLabel || trans.__('Shut Down All');
205
+ const shutdownTitle = `${shutdownAllLabel}?`;
206
+ const shutdownAllConfirmationText = options.manager.shutdownAllConfirmationText ||
207
+ `${shutdownAllLabel} ${options.manager.name}`;
208
+ this.addClass(SECTION_CLASS);
209
+ this.title.label = options.manager.name;
210
+ function onShutdown() {
211
+ void showDialog({
212
+ title: shutdownTitle,
213
+ body: shutdownAllConfirmationText,
214
+ buttons: [
215
+ Dialog.cancelButton(),
216
+ Dialog.warnButton({ label: shutdownAllLabel })
217
+ ]
218
+ }).then(result => {
219
+ if (result.button.accept) {
220
+ options.manager.shutdownAll();
221
+ }
222
+ });
223
+ }
224
+ let runningItems = options.manager.running();
225
+ const enabled = runningItems.length > 0;
226
+ this._button = new ToolbarButton({
227
+ label: shutdownAllLabel,
228
+ className: `${SHUTDOWN_ALL_BUTTON_CLASS} jp-mod-styled ${!enabled && 'jp-mod-disabled'}`,
229
+ enabled,
230
+ onClick: onShutdown
133
231
  });
232
+ this._manager.runningChanged.connect(this._updateButton, this);
233
+ this.toolbar.addItem('shutdown-all', this._button);
234
+ this.addWidget(new ListWidget({ runningItems, shutdownAllLabel, ...options }));
235
+ }
236
+ /**
237
+ * Dispose the resources held by the widget
238
+ */
239
+ dispose() {
240
+ if (this.isDisposed) {
241
+ return;
242
+ }
243
+ this._manager.runningChanged.disconnect(this._updateButton, this);
244
+ super.dispose();
245
+ }
246
+ _updateButton() {
247
+ var _a, _b;
248
+ const button = this._button;
249
+ button.enabled = this._manager.running().length > 0;
250
+ if (button.enabled) {
251
+ (_a = button.node.querySelector('button')) === null || _a === void 0 ? void 0 : _a.classList.remove('jp-mod-disabled');
252
+ }
253
+ else {
254
+ (_b = button.node.querySelector('button')) === null || _b === void 0 ? void 0 : _b.classList.add('jp-mod-disabled');
255
+ }
134
256
  }
135
- return (React.createElement("div", { className: SECTION_CLASS },
136
- React.createElement(React.Fragment, null,
137
- React.createElement("div", { className: `${SECTION_HEADER_CLASS} jp-stack-panel-header` },
138
- React.createElement("h2", null, props.manager.name),
139
- React.createElement(UseSignal, { signal: props.manager.runningChanged }, () => {
140
- const disabled = props.manager.running().length === 0;
141
- return (React.createElement("button", { className: `${SHUTDOWN_ALL_BUTTON_CLASS} jp-mod-styled ${disabled && 'jp-mod-disabled'}`, disabled: disabled, onClick: onShutdown }, shutdownAllLabel));
142
- })),
143
- React.createElement("div", { className: CONTAINER_CLASS },
144
- React.createElement(List, { manager: props.manager, shutdownLabel: props.manager.shutdownLabel, shutdownAllLabel: shutdownAllLabel, translator: props.translator })))));
145
- }
146
- function RunningSessionsComponent(props) {
147
- const translator = props.translator || nullTranslator;
148
- const trans = translator.load('jupyterlab');
149
- return (React.createElement(React.Fragment, null,
150
- React.createElement("div", { className: HEADER_CLASS },
151
- React.createElement(ToolbarButtonComponent, { tooltip: trans.__('Refresh List'), icon: refreshIcon, onClick: () => props.managers.items().forEach(manager => manager.refreshRunning()) })),
152
- props.managers.items().map(manager => (React.createElement(Section, { key: manager.name, manager: manager, translator: props.translator })))));
153
257
  }
154
258
  /**
155
259
  * A class that exposes the running terminal and kernel sessions.
156
260
  */
157
- export class RunningSessions extends ReactWidget {
261
+ export class RunningSessions extends SidePanel {
158
262
  /**
159
263
  * Construct a new running widget.
160
264
  */
161
265
  constructor(managers, translator) {
162
266
  super();
163
267
  this.managers = managers;
164
- this.translator = translator || nullTranslator;
165
- // this can't be in the react element, because then it would be too nested
268
+ this.translator = translator !== null && translator !== void 0 ? translator : nullTranslator;
269
+ const trans = this.translator.load('jupyterlab');
166
270
  this.addClass(RUNNING_CLASS);
271
+ this.toolbar.addItem('refresh', new ToolbarButton({
272
+ tooltip: trans.__('Refresh List'),
273
+ icon: refreshIcon,
274
+ onClick: () => managers.items().forEach(manager => manager.refreshRunning())
275
+ }));
276
+ managers.items().forEach(manager => this.addSection(managers, manager));
277
+ managers.added.connect(this.addSection, this);
167
278
  }
168
- render() {
169
- return (React.createElement(RunningSessionsComponent, { managers: this.managers, translator: this.translator }));
279
+ /**
280
+ * Dispose the resources held by the widget
281
+ */
282
+ dispose() {
283
+ if (this.isDisposed) {
284
+ return;
285
+ }
286
+ this.managers.added.disconnect(this.addSection, this);
287
+ super.dispose();
288
+ }
289
+ /**
290
+ * Add a section for a new manager.
291
+ *
292
+ * @param managers Managers
293
+ * @param manager New manager
294
+ */
295
+ addSection(_, manager) {
296
+ this.addWidget(new Section({ manager, translator: this.translator }));
170
297
  }
171
298
  }
172
299
  //# sourceMappingURL=index.js.map
package/lib/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.tsx"],"names":[],"mappings":"AAAA,0CAA0C;AAC1C,2DAA2D;AAC3D;;;GAGG;AAEH,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAC1D,OAAO,EAAe,cAAc,EAAE,MAAM,yBAAyB,CAAC;AACtE,OAAO,EACL,SAAS,EAET,WAAW,EACX,WA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C,OAAO,CAAC,OAAO,CAAC,EAAE,CAAC,IAAI,CAAC,UAAU,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC,CAAC;QAExE,QAAQ,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,UAAU,EAAE,IAAI,CAAC,CAAC;IAChD,CAAC;IAED;;OAEG;IACH,OAAO;QACL,IAAI,IAAI,CAAC,UAAU,EAAE;YACnB,OAAO;SACR;QACD,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,UAAU,CAAC,IAAI,CAAC,UAAU,EAAE,IAAI,CAAC,CAAC;QACtD,KAAK,CAAC,OAAO,EAAE,CAAC;IAClB,CAAC;IAED;;;;;OAKG;IACO,UAAU,CAAC,CAAU,EAAE,OAAkC;QACjE,IAAI,CAAC,SAAS,CAAC,IAAI,OAAO,CAAC,EAAE,OAAO,EAAE,UAAU,EAAE,IAAI,CAAC,UAAU,EAAE,CAAC,CAAC,CAAC;IACxE,CAAC;CAIF"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jupyterlab/running",
3
- "version": "4.0.0-alpha.9",
3
+ "version": "4.0.0-beta.1",
4
4
  "description": "JupyterLab - Running Sessions Panel",
5
5
  "homepage": "https://github.com/jupyterlab/jupyterlab",
6
6
  "bugs": {
@@ -27,7 +27,8 @@
27
27
  "lib/*.js.map",
28
28
  "lib/*.js",
29
29
  "style/*.css",
30
- "style/index.js"
30
+ "style/index.js",
31
+ "src/**/*.{ts,tsx}"
31
32
  ],
32
33
  "scripts": {
33
34
  "build": "tsc -b",
@@ -36,18 +37,20 @@
36
37
  "watch": "tsc -b --watch"
37
38
  },
38
39
  "dependencies": {
39
- "@jupyterlab/apputils": "^4.0.0-alpha.9",
40
- "@jupyterlab/translation": "^4.0.0-alpha.9",
41
- "@jupyterlab/ui-components": "^4.0.0-alpha.24",
42
- "@lumino/coreutils": "^1.12.0",
43
- "@lumino/disposable": "^1.10.1",
44
- "@lumino/signaling": "^1.10.1",
45
- "react": "^17.0.1"
40
+ "@jupyterlab/apputils": "^4.0.0-beta.1",
41
+ "@jupyterlab/translation": "^4.0.0-beta.1",
42
+ "@jupyterlab/ui-components": "^4.0.0-beta.1",
43
+ "@lumino/coreutils": "^2.0.0",
44
+ "@lumino/disposable": "^2.0.0",
45
+ "@lumino/messaging": "^2.0.0",
46
+ "@lumino/signaling": "^2.0.0",
47
+ "@lumino/widgets": "^2.0.1",
48
+ "react": "^18.2.0"
46
49
  },
47
50
  "devDependencies": {
48
51
  "rimraf": "~3.0.0",
49
- "typedoc": "~0.22.10",
50
- "typescript": "~4.6.3"
52
+ "typedoc": "~0.23.25",
53
+ "typescript": "~5.0.2"
51
54
  },
52
55
  "publishConfig": {
53
56
  "access": "public"
package/src/index.tsx ADDED
@@ -0,0 +1,585 @@
1
+ // Copyright (c) Jupyter Development Team.
2
+ // Distributed under the terms of the Modified BSD License.
3
+ /**
4
+ * @packageDocumentation
5
+ * @module running
6
+ */
7
+
8
+ import { Dialog, showDialog } from '@jupyterlab/apputils';
9
+ import { ITranslator, nullTranslator } from '@jupyterlab/translation';
10
+ import {
11
+ caretDownIcon,
12
+ caretRightIcon,
13
+ closeIcon,
14
+ LabIcon,
15
+ PanelWithToolbar,
16
+ ReactWidget,
17
+ refreshIcon,
18
+ SidePanel,
19
+ ToolbarButton,
20
+ ToolbarButtonComponent,
21
+ UseSignal
22
+ } from '@jupyterlab/ui-components';
23
+ import { Token } from '@lumino/coreutils';
24
+ import { DisposableDelegate, IDisposable } from '@lumino/disposable';
25
+ import { Message } from '@lumino/messaging';
26
+ import { ISignal, Signal } from '@lumino/signaling';
27
+ import { Widget } from '@lumino/widgets';
28
+ import * as React from 'react';
29
+
30
+ /**
31
+ * The class name added to a running widget.
32
+ */
33
+ const RUNNING_CLASS = 'jp-RunningSessions';
34
+
35
+ /**
36
+ * The class name added to the running terminal sessions section.
37
+ */
38
+ const SECTION_CLASS = 'jp-RunningSessions-section';
39
+
40
+ /**
41
+ * The class name added to a section container.
42
+ */
43
+ const CONTAINER_CLASS = 'jp-RunningSessions-sectionContainer';
44
+
45
+ /**
46
+ * The class name added to the running kernel sessions section list.
47
+ */
48
+ const LIST_CLASS = 'jp-RunningSessions-sectionList';
49
+
50
+ /**
51
+ * The class name added to the running sessions items.
52
+ */
53
+ const ITEM_CLASS = 'jp-RunningSessions-item';
54
+
55
+ /**
56
+ * The class name added to a running session item label.
57
+ */
58
+ const ITEM_LABEL_CLASS = 'jp-RunningSessions-itemLabel';
59
+
60
+ /**
61
+ * The class name added to a running session item detail.
62
+ */
63
+ const ITEM_DETAIL_CLASS = 'jp-RunningSessions-itemDetail';
64
+
65
+ /**
66
+ * The class name added to a running session item shutdown button.
67
+ */
68
+ const SHUTDOWN_BUTTON_CLASS = 'jp-RunningSessions-itemShutdown';
69
+
70
+ /**
71
+ * The class name added to a running session item shutdown button.
72
+ */
73
+ const SHUTDOWN_ALL_BUTTON_CLASS = 'jp-RunningSessions-shutdownAll';
74
+
75
+ /**
76
+ * The running sessions token.
77
+ */
78
+ export const IRunningSessionManagers = new Token<IRunningSessionManagers>(
79
+ '@jupyterlab/running:IRunningSessionManagers'
80
+ );
81
+
82
+ /**
83
+ * The running interface.
84
+ */
85
+ export interface IRunningSessionManagers {
86
+ /**
87
+ * Add a running item manager.
88
+ *
89
+ * @param manager - The running item manager.
90
+ *
91
+ */
92
+ add(manager: IRunningSessions.IManager): IDisposable;
93
+
94
+ /**
95
+ * Signal emitted when a new manager is added.
96
+ */
97
+ added: ISignal<IRunningSessionManagers, IRunningSessions.IManager>;
98
+
99
+ /**
100
+ * Return an array of managers.
101
+ */
102
+ items(): ReadonlyArray<IRunningSessions.IManager>;
103
+ }
104
+
105
+ export class RunningSessionManagers implements IRunningSessionManagers {
106
+ /**
107
+ * Signal emitted when a new manager is added.
108
+ */
109
+ get added(): ISignal<this, IRunningSessions.IManager> {
110
+ return this._added;
111
+ }
112
+
113
+ /**
114
+ * Add a running item manager.
115
+ *
116
+ * @param manager - The running item manager.
117
+ *
118
+ */
119
+ add(manager: IRunningSessions.IManager): IDisposable {
120
+ this._managers.push(manager);
121
+ this._added.emit(manager);
122
+ return new DisposableDelegate(() => {
123
+ const i = this._managers.indexOf(manager);
124
+
125
+ if (i > -1) {
126
+ this._managers.splice(i, 1);
127
+ }
128
+ });
129
+ }
130
+
131
+ /**
132
+ * Return an iterator of launcher items.
133
+ */
134
+ items(): ReadonlyArray<IRunningSessions.IManager> {
135
+ return this._managers;
136
+ }
137
+
138
+ private _added = new Signal<this, IRunningSessions.IManager>(this);
139
+ private _managers: IRunningSessions.IManager[] = [];
140
+ }
141
+
142
+ function Item(props: {
143
+ child?: boolean;
144
+ runningItem: IRunningSessions.IRunningItem;
145
+ shutdownLabel?: string;
146
+ shutdownItemIcon?: LabIcon;
147
+ translator?: ITranslator;
148
+ }) {
149
+ const { runningItem } = props;
150
+ const classList = [ITEM_CLASS];
151
+ const detail = runningItem.detail?.();
152
+ const icon = runningItem.icon();
153
+ const title = runningItem.labelTitle ? runningItem.labelTitle() : '';
154
+ const translator = props.translator || nullTranslator;
155
+ const trans = translator.load('jupyterlab');
156
+
157
+ // Handle shutdown requests.
158
+ let stopPropagation = false;
159
+ const shutdownItemIcon = props.shutdownItemIcon || closeIcon;
160
+ const shutdownLabel = props.shutdownLabel || trans.__('Shut Down');
161
+ const shutdown = () => {
162
+ stopPropagation = true;
163
+ runningItem.shutdown?.();
164
+ };
165
+
166
+ // Manage collapsed state. Use the shutdown flag in lieu of `stopPropagation`.
167
+ const [collapsed, collapse] = React.useState(false);
168
+ const collapsible = !!runningItem.children?.length;
169
+ const onClick = collapsible
170
+ ? () => !stopPropagation && collapse(!collapsed)
171
+ : undefined;
172
+
173
+ if (runningItem.className) {
174
+ classList.push(runningItem.className);
175
+ }
176
+ if (props.child) {
177
+ classList.push('jp-mod-running-child');
178
+ }
179
+
180
+ return (
181
+ <>
182
+ <li>
183
+ <div
184
+ className={classList.join(' ')}
185
+ onClick={onClick}
186
+ data-context={runningItem.context || ''}
187
+ >
188
+ {collapsible &&
189
+ (collapsed ? (
190
+ <caretRightIcon.react tag="span" stylesheet="runningItem" />
191
+ ) : (
192
+ <caretDownIcon.react tag="span" stylesheet="runningItem" />
193
+ ))}
194
+ {typeof icon === 'string' ? (
195
+ icon ? (
196
+ <img src={icon} />
197
+ ) : undefined
198
+ ) : (
199
+ <icon.react tag="span" stylesheet="runningItem" />
200
+ )}
201
+ <span
202
+ className={ITEM_LABEL_CLASS}
203
+ title={title}
204
+ onClick={runningItem.open && (() => runningItem.open!())}
205
+ >
206
+ {runningItem.label()}
207
+ </span>
208
+ {detail && <span className={ITEM_DETAIL_CLASS}>{detail}</span>}
209
+ {runningItem.shutdown && (
210
+ <ToolbarButtonComponent
211
+ className={SHUTDOWN_BUTTON_CLASS}
212
+ icon={shutdownItemIcon}
213
+ onClick={shutdown}
214
+ tooltip={shutdownLabel}
215
+ />
216
+ )}
217
+ </div>
218
+ {collapsible && !collapsed && (
219
+ <List
220
+ child={true}
221
+ runningItems={runningItem.children!}
222
+ shutdownItemIcon={shutdownItemIcon}
223
+ translator={translator}
224
+ />
225
+ )}
226
+ </li>
227
+ </>
228
+ );
229
+ }
230
+
231
+ function List(props: {
232
+ child?: boolean;
233
+ runningItems: IRunningSessions.IRunningItem[];
234
+ shutdownLabel?: string;
235
+ shutdownAllLabel?: string;
236
+ shutdownItemIcon?: LabIcon;
237
+ translator?: ITranslator;
238
+ }) {
239
+ return (
240
+ <ul className={LIST_CLASS}>
241
+ {props.runningItems.map((item, i) => (
242
+ <Item
243
+ child={props.child}
244
+ key={i}
245
+ runningItem={item}
246
+ shutdownLabel={props.shutdownLabel}
247
+ shutdownItemIcon={props.shutdownItemIcon}
248
+ translator={props.translator}
249
+ />
250
+ ))}
251
+ </ul>
252
+ );
253
+ }
254
+
255
+ class ListWidget extends ReactWidget {
256
+ constructor(
257
+ private _options: {
258
+ manager: IRunningSessions.IManager;
259
+ runningItems: IRunningSessions.IRunningItem[];
260
+ shutdownAllLabel: string;
261
+ translator?: ITranslator;
262
+ }
263
+ ) {
264
+ super();
265
+ _options.manager.runningChanged.connect(this._emitUpdate, this);
266
+ }
267
+
268
+ dispose() {
269
+ this._options.manager.runningChanged.disconnect(this._emitUpdate, this);
270
+ super.dispose();
271
+ }
272
+
273
+ protected onBeforeShow(msg: Message): void {
274
+ super.onBeforeShow(msg);
275
+ this._update.emit();
276
+ }
277
+
278
+ render(): JSX.Element {
279
+ const options = this._options;
280
+ let cached = true;
281
+ return (
282
+ <UseSignal signal={this._update}>
283
+ {() => {
284
+ // Cache the running items for the intial load and request from
285
+ // the service every subsequent load.
286
+ if (cached) {
287
+ cached = false;
288
+ } else {
289
+ options.runningItems = options.manager.running();
290
+ }
291
+ return (
292
+ <div className={CONTAINER_CLASS}>
293
+ <List
294
+ runningItems={options.runningItems}
295
+ shutdownLabel={options.manager.shutdownLabel}
296
+ shutdownAllLabel={options.shutdownAllLabel}
297
+ shutdownItemIcon={options.manager.shutdownItemIcon}
298
+ translator={options.translator}
299
+ />
300
+ </div>
301
+ );
302
+ }}
303
+ </UseSignal>
304
+ );
305
+ }
306
+
307
+ /**
308
+ * Check if the widget or any of it's parents is hidden.
309
+ *
310
+ * Checking parents is necessary as lumino does not propagate visibility
311
+ * changes from parents down to children (although it does notify parents
312
+ * about changes to children visibility).
313
+ */
314
+ private _isAnyHidden() {
315
+ let isHidden = this.isHidden;
316
+ if (isHidden) {
317
+ return isHidden;
318
+ }
319
+ let parent: Widget | null = this.parent;
320
+ while (parent != null) {
321
+ if (parent.isHidden) {
322
+ isHidden = true;
323
+ break;
324
+ }
325
+ parent = parent.parent;
326
+ }
327
+ return isHidden;
328
+ }
329
+
330
+ private _emitUpdate() {
331
+ if (this._isAnyHidden()) {
332
+ return;
333
+ }
334
+ this._update.emit();
335
+ }
336
+
337
+ private _update: Signal<ListWidget, void> = new Signal(this);
338
+ }
339
+
340
+ /**
341
+ * The Section component contains the shared look and feel for an interactive
342
+ * list of kernels and sessions.
343
+ *
344
+ * It is specialized for each based on its props.
345
+ */
346
+ class Section extends PanelWithToolbar {
347
+ constructor(options: {
348
+ manager: IRunningSessions.IManager;
349
+ translator?: ITranslator;
350
+ }) {
351
+ super();
352
+ this._manager = options.manager;
353
+ const translator = options.translator || nullTranslator;
354
+ const trans = translator.load('jupyterlab');
355
+ const shutdownAllLabel =
356
+ options.manager.shutdownAllLabel || trans.__('Shut Down All');
357
+ const shutdownTitle = `${shutdownAllLabel}?`;
358
+ const shutdownAllConfirmationText =
359
+ options.manager.shutdownAllConfirmationText ||
360
+ `${shutdownAllLabel} ${options.manager.name}`;
361
+
362
+ this.addClass(SECTION_CLASS);
363
+ this.title.label = options.manager.name;
364
+
365
+ function onShutdown() {
366
+ void showDialog({
367
+ title: shutdownTitle,
368
+ body: shutdownAllConfirmationText,
369
+ buttons: [
370
+ Dialog.cancelButton(),
371
+ Dialog.warnButton({ label: shutdownAllLabel })
372
+ ]
373
+ }).then(result => {
374
+ if (result.button.accept) {
375
+ options.manager.shutdownAll();
376
+ }
377
+ });
378
+ }
379
+
380
+ let runningItems = options.manager.running();
381
+ const enabled = runningItems.length > 0;
382
+ this._button = new ToolbarButton({
383
+ label: shutdownAllLabel,
384
+ className: `${SHUTDOWN_ALL_BUTTON_CLASS} jp-mod-styled ${
385
+ !enabled && 'jp-mod-disabled'
386
+ }`,
387
+ enabled,
388
+ onClick: onShutdown
389
+ });
390
+ this._manager.runningChanged.connect(this._updateButton, this);
391
+
392
+ this.toolbar.addItem('shutdown-all', this._button);
393
+
394
+ this.addWidget(
395
+ new ListWidget({ runningItems, shutdownAllLabel, ...options })
396
+ );
397
+ }
398
+
399
+ /**
400
+ * Dispose the resources held by the widget
401
+ */
402
+ dispose(): void {
403
+ if (this.isDisposed) {
404
+ return;
405
+ }
406
+ this._manager.runningChanged.disconnect(this._updateButton, this);
407
+ super.dispose();
408
+ }
409
+
410
+ private _updateButton(): void {
411
+ const button = this._button;
412
+ button.enabled = this._manager.running().length > 0;
413
+ if (button.enabled) {
414
+ button.node.querySelector('button')?.classList.remove('jp-mod-disabled');
415
+ } else {
416
+ button.node.querySelector('button')?.classList.add('jp-mod-disabled');
417
+ }
418
+ }
419
+
420
+ private _button: ToolbarButton;
421
+ private _manager: IRunningSessions.IManager;
422
+ }
423
+
424
+ /**
425
+ * A class that exposes the running terminal and kernel sessions.
426
+ */
427
+ export class RunningSessions extends SidePanel {
428
+ /**
429
+ * Construct a new running widget.
430
+ */
431
+ constructor(managers: IRunningSessionManagers, translator?: ITranslator) {
432
+ super();
433
+ this.managers = managers;
434
+ this.translator = translator ?? nullTranslator;
435
+ const trans = this.translator.load('jupyterlab');
436
+
437
+ this.addClass(RUNNING_CLASS);
438
+
439
+ this.toolbar.addItem(
440
+ 'refresh',
441
+ new ToolbarButton({
442
+ tooltip: trans.__('Refresh List'),
443
+ icon: refreshIcon,
444
+ onClick: () =>
445
+ managers.items().forEach(manager => manager.refreshRunning())
446
+ })
447
+ );
448
+
449
+ managers.items().forEach(manager => this.addSection(managers, manager));
450
+
451
+ managers.added.connect(this.addSection, this);
452
+ }
453
+
454
+ /**
455
+ * Dispose the resources held by the widget
456
+ */
457
+ dispose(): void {
458
+ if (this.isDisposed) {
459
+ return;
460
+ }
461
+ this.managers.added.disconnect(this.addSection, this);
462
+ super.dispose();
463
+ }
464
+
465
+ /**
466
+ * Add a section for a new manager.
467
+ *
468
+ * @param managers Managers
469
+ * @param manager New manager
470
+ */
471
+ protected addSection(_: unknown, manager: IRunningSessions.IManager) {
472
+ this.addWidget(new Section({ manager, translator: this.translator }));
473
+ }
474
+
475
+ protected managers: IRunningSessionManagers;
476
+ protected translator: ITranslator;
477
+ }
478
+
479
+ /**
480
+ * The namespace for the `IRunningSessions` class statics.
481
+ */
482
+ export namespace IRunningSessions {
483
+ /**
484
+ * A manager of running items grouped under a single section.
485
+ */
486
+ export interface IManager {
487
+ /**
488
+ * Name that is shown to the user in plural.
489
+ */
490
+ name: string;
491
+
492
+ /**
493
+ * Called when the shutdown all button is pressed.
494
+ */
495
+ shutdownAll(): void;
496
+
497
+ /**
498
+ * List the running models.
499
+ */
500
+ running(): IRunningItem[];
501
+
502
+ /**
503
+ * Force a refresh of the running models.
504
+ */
505
+ refreshRunning(): void;
506
+
507
+ /**
508
+ * A signal that should be emitted when the item list has changed.
509
+ */
510
+ runningChanged: ISignal<any, any>;
511
+
512
+ /**
513
+ * A string used to describe the shutdown action.
514
+ */
515
+ shutdownLabel?: string;
516
+
517
+ /**
518
+ * A string used to describe the shutdown all action.
519
+ */
520
+ shutdownAllLabel?: string;
521
+
522
+ /**
523
+ * A string used as the body text in the shutdown all confirmation dialog.
524
+ */
525
+ shutdownAllConfirmationText?: string;
526
+
527
+ /**
528
+ * The icon to show for shutting down an individual item in this section.
529
+ */
530
+ shutdownItemIcon?: LabIcon;
531
+ }
532
+
533
+ /**
534
+ * A running item.
535
+ */
536
+ export interface IRunningItem {
537
+ /**
538
+ * Optional child nodes that belong to a top-level running item.
539
+ */
540
+ children?: IRunningItem[];
541
+
542
+ /**
543
+ * Optional CSS class name to add to the running item.
544
+ */
545
+ className?: string;
546
+
547
+ /**
548
+ * Optional context hint to add to the `data-context` attribute of an item.
549
+ */
550
+ context?: string;
551
+
552
+ /**
553
+ * Called when the running item is clicked.
554
+ */
555
+ open?: () => void;
556
+
557
+ /**
558
+ * Called when the shutdown button is pressed on a particular item.
559
+ */
560
+ shutdown?: () => void;
561
+
562
+ /**
563
+ * The `LabIcon` to use as the icon for the running item or the string
564
+ * `src` URL.
565
+ */
566
+ icon: () => LabIcon | string;
567
+
568
+ /**
569
+ * Called to determine the label for each item.
570
+ */
571
+ label: () => string;
572
+
573
+ /**
574
+ * Called to determine the `title` attribute for each item, which is
575
+ * revealed on hover.
576
+ */
577
+ labelTitle?: () => string;
578
+
579
+ /**
580
+ * Called to determine the `detail` attribute, which is shown optionally in
581
+ * a column after the label.
582
+ */
583
+ detail?: () => string;
584
+ }
585
+ }
package/style/base.css CHANGED
@@ -1,12 +1,14 @@
1
+ /*
2
+ * Copyright (c) Jupyter Development Team.
3
+ * Distributed under the terms of the Modified BSD License.
4
+ */
5
+
1
6
  /*-----------------------------------------------------------------------------
2
7
  | Variables
3
8
  |----------------------------------------------------------------------------*/
4
9
 
5
10
  :root {
6
- --jp-private-running-button-height: 28px;
7
- --jp-private-running-button-width: 48px;
8
11
  --jp-private-running-item-height: 24px;
9
- --jp-private-running-shutdown-button-height: 24px;
10
12
  }
11
13
 
12
14
  /*-----------------------------------------------------------------------------
@@ -26,52 +28,23 @@
26
28
  font-size: var(--jp-ui-font-size1);
27
29
  }
28
30
 
29
- .jp-RunningSessions-header {
30
- flex: 0 0 auto;
31
- display: flex;
32
- flex-direction: row;
31
+ .jp-RunningSessions > .jp-SidePanel-toolbar {
33
32
  justify-content: flex-end;
34
33
  }
35
34
 
36
35
  .jp-RunningSessions-section {
37
- display: flex;
38
- flex: 0 1 auto;
39
- flex-direction: column;
36
+ min-height: 50px;
40
37
  overflow: auto;
41
38
  }
42
39
 
43
- .jp-RunningSessions-sectionHeader {
44
- flex: 0 0 auto;
45
- align-items: center;
46
- justify-content: space-between;
47
- height: 28px;
48
- display: flex;
49
- border-bottom: var(--jp-border-width) solid var(--jp-border-color2);
50
- margin-top: 8px;
51
- }
52
-
53
- .jp-RunningSessions-sectionHeader h2 {
54
- flex: 0 0 auto;
55
- font-weight: 600;
56
- text-transform: uppercase;
57
- letter-spacing: 1px;
58
- font-size: var(--jp-ui-font-size0);
59
- padding: 8px 8px 8px 12px;
60
- margin: 0;
61
- }
62
-
63
- .jp-RunningSessions-sectionHeader .jp-ToolbarButtonComponent {
64
- flex: 0 0 auto;
65
- }
66
-
67
40
  .jp-RunningSessions-sectionContainer {
68
- flex: 1 1 auto;
69
41
  margin: 0;
70
42
  padding: 0;
71
43
  overflow: auto;
72
44
  }
73
45
 
74
46
  .jp-RunningSessions-sectionList {
47
+ display: block;
75
48
  margin: 0;
76
49
  padding: 0;
77
50
  list-style-type: none;
@@ -90,6 +63,15 @@
90
63
  background-color: var(--jp-layout-color2);
91
64
  }
92
65
 
66
+ .jp-RunningSessions-item.jp-mod-running-child {
67
+ padding-left: 40px;
68
+ }
69
+
70
+ .jp-RunningSessions-item img {
71
+ height: 16px;
72
+ margin-top: 4px;
73
+ }
74
+
93
75
  .jp-RunningSessions-itemLabel {
94
76
  font-size: var(--jp-ui-font-size1);
95
77
  flex: 1 1 55%;
@@ -118,8 +100,6 @@
118
100
 
119
101
  .jp-RunningSessions-item:not(:hover) .jp-RunningSessions-itemShutdown {
120
102
  visibility: hidden;
121
-
122
- /* display: none; */
123
103
  }
124
104
 
125
105
  .jp-RunningSessions-sectionList
@@ -128,32 +108,34 @@
128
108
  background: var(--jp-layout-color3);
129
109
  }
130
110
 
131
- .jp-RunningSessions-shutdownAll.jp-mod-styled {
132
- margin: 0 8px;
111
+ .jp-RunningSessions-shutdownAll.jp-mod-styled
112
+ > .jp-ToolbarButtonComponent-label {
133
113
  color: var(--jp-warn-color1);
134
114
  background-color: transparent;
135
- height: var(--jp-private-running-shutdown-button-height);
136
- line-height: var(--jp-private-running-shutdown-button-height);
137
115
  border-radius: 2px;
138
116
  overflow: hidden;
139
117
  white-space: nowrap;
140
118
  text-overflow: ellipsis;
141
119
  }
142
120
 
143
- .jp-RunningSessions-shutdownAll.jp-mod-styled:hover {
121
+ .jp-RunningSessions-shutdownAll.jp-mod-styled:hover
122
+ > .jp-ToolbarButtonComponent-label {
144
123
  background-color: var(--jp-layout-color2);
145
124
  }
146
125
 
147
- .jp-RunningSessions-shutdownAll.jp-mod-styled:focus {
126
+ .jp-RunningSessions-shutdownAll.jp-mod-styled:focus
127
+ > .jp-ToolbarButtonComponent-label {
148
128
  border: none;
149
129
  box-shadow: none;
150
130
  background-color: var(--jp-layout-color2);
151
131
  }
152
132
 
153
- .jp-RunningSessions-shutdownAll.jp-mod-styled.jp-mod-disabled {
133
+ .jp-RunningSessions-shutdownAll.jp-mod-styled.jp-mod-disabled
134
+ > .jp-ToolbarButtonComponent-label {
154
135
  color: var(--jp-ui-font-color2);
155
136
  }
156
137
 
157
- .jp-RunningSessions-shutdownAll.jp-mod-styled.jp-mod-disabled:hover {
138
+ .jp-RunningSessions-shutdownAll.jp-mod-styled.jp-mod-disabled:hover
139
+ > .jp-ToolbarButtonComponent-label {
158
140
  background: none;
159
141
  }
package/style/index.css CHANGED
@@ -4,6 +4,7 @@
4
4
  |----------------------------------------------------------------------------*/
5
5
 
6
6
  /* This file was auto-generated by ensurePackage() in @jupyterlab/buildutils */
7
+ @import url('~@lumino/widgets/style/index.css');
7
8
  @import url('~@jupyterlab/ui-components/style/index.css');
8
9
  @import url('~@jupyterlab/apputils/style/index.css');
9
10
 
package/style/index.js CHANGED
@@ -4,6 +4,7 @@
4
4
  |----------------------------------------------------------------------------*/
5
5
 
6
6
  /* This file was auto-generated by ensurePackage() in @jupyterlab/buildutils */
7
+ import '@lumino/widgets/style/index.js';
7
8
  import '@jupyterlab/ui-components/style/index.js';
8
9
  import '@jupyterlab/apputils/style/index.js';
9
10