@jupyterlab/running 4.0.0-alpha.2 → 4.0.0-alpha.21

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
  */
@@ -54,15 +47,21 @@ const SHUTDOWN_BUTTON_CLASS = 'jp-RunningSessions-itemShutdown';
54
47
  * The class name added to a running session item shutdown button.
55
48
  */
56
49
  const SHUTDOWN_ALL_BUTTON_CLASS = 'jp-RunningSessions-shutdownAll';
57
- /* tslint:disable */
58
50
  /**
59
51
  * The running sessions token.
60
52
  */
61
53
  export const IRunningSessionManagers = new Token('@jupyterlab/running:IRunningSessionManagers');
62
54
  export class RunningSessionManagers {
63
55
  constructor() {
56
+ this._added = new Signal(this);
64
57
  this._managers = [];
65
58
  }
59
+ /**
60
+ * Signal emitted when a new manager is added.
61
+ */
62
+ get added() {
63
+ return this._added;
64
+ }
66
65
  /**
67
66
  * Add a running item manager.
68
67
  *
@@ -71,6 +70,7 @@ export class RunningSessionManagers {
71
70
  */
72
71
  add(manager) {
73
72
  this._managers.push(manager);
73
+ this._added.emit(manager);
74
74
  return new DisposableDelegate(() => {
75
75
  const i = this._managers.indexOf(manager);
76
76
  if (i > -1) {
@@ -86,25 +86,108 @@ export class RunningSessionManagers {
86
86
  }
87
87
  }
88
88
  function Item(props) {
89
- var _a;
89
+ var _a, _b;
90
90
  const { runningItem } = props;
91
- const icon = runningItem.icon();
91
+ const classList = [ITEM_CLASS];
92
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() : '';
93
95
  const translator = props.translator || nullTranslator;
94
96
  const trans = translator.load('jupyterlab');
95
- const shutdownLabel = props.shutdownLabel || trans.__('Shut Down');
97
+ // Handle shutdown requests.
98
+ let stopPropagation = false;
96
99
  const shutdownItemIcon = props.shutdownItemIcon || closeIcon;
97
- return (React.createElement("li", { className: ITEM_CLASS },
98
- React.createElement(icon.react, { tag: "span", stylesheet: "runningItem" }),
99
- React.createElement("span", { className: ITEM_LABEL_CLASS, title: runningItem.labelTitle ? runningItem.labelTitle() : '', onClick: () => runningItem.open() }, runningItem.label()),
100
- detail && React.createElement("span", { className: ITEM_DETAIL_CLASS }, detail),
101
- React.createElement(ToolbarButtonComponent, { className: SHUTDOWN_BUTTON_CLASS, icon: shutdownItemIcon, onClick: () => runningItem.shutdown(), tooltip: shutdownLabel })));
102
- }
103
- function ListView(props) {
104
- 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 })))));
105
128
  }
106
129
  function List(props) {
107
- 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
+ }
108
191
  }
109
192
  /**
110
193
  * The Section component contains the shared look and feel for an interactive
@@ -112,62 +195,105 @@ function List(props) {
112
195
  *
113
196
  * It is specialized for each based on its props.
114
197
  */
115
- function Section(props) {
116
- const translator = props.translator || nullTranslator;
117
- const trans = translator.load('jupyterlab');
118
- const shutdownAllLabel = props.manager.shutdownAllLabel || trans.__('Shut Down All');
119
- const shutdownTitle = `${shutdownAllLabel}?`;
120
- const shutdownAllConfirmationText = props.manager.shutdownAllConfirmationText ||
121
- `${shutdownAllLabel} ${props.manager.name}`;
122
- function onShutdown() {
123
- void showDialog({
124
- title: shutdownTitle,
125
- body: shutdownAllConfirmationText,
126
- buttons: [
127
- Dialog.cancelButton({ label: trans.__('Cancel') }),
128
- Dialog.warnButton({ label: shutdownAllLabel })
129
- ]
130
- }).then(result => {
131
- if (result.button.accept) {
132
- props.manager.shutdownAll();
133
- }
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
134
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
+ }
135
256
  }
136
- return (React.createElement("div", { className: SECTION_CLASS },
137
- React.createElement(React.Fragment, null,
138
- React.createElement("div", { className: `${SECTION_HEADER_CLASS} jp-stack-panel-header` },
139
- React.createElement("h2", null, props.manager.name),
140
- React.createElement(UseSignal, { signal: props.manager.runningChanged }, () => {
141
- const disabled = props.manager.running().length === 0;
142
- return (React.createElement("button", { className: `${SHUTDOWN_ALL_BUTTON_CLASS} jp-mod-styled ${disabled && 'jp-mod-disabled'}`, disabled: disabled, onClick: onShutdown }, shutdownAllLabel));
143
- })),
144
- React.createElement("div", { className: CONTAINER_CLASS },
145
- React.createElement(List, { manager: props.manager, shutdownLabel: props.manager.shutdownLabel, shutdownAllLabel: shutdownAllLabel, translator: props.translator })))));
146
- }
147
- function RunningSessionsComponent(props) {
148
- const translator = props.translator || nullTranslator;
149
- const trans = translator.load('jupyterlab');
150
- return (React.createElement(React.Fragment, null,
151
- React.createElement("div", { className: HEADER_CLASS },
152
- React.createElement(ToolbarButtonComponent, { tooltip: trans.__('Refresh List'), icon: refreshIcon, onClick: () => props.managers.items().forEach(manager => manager.refreshRunning()) })),
153
- props.managers.items().map(manager => (React.createElement(Section, { key: manager.name, manager: manager, translator: props.translator })))));
154
257
  }
155
258
  /**
156
259
  * A class that exposes the running terminal and kernel sessions.
157
260
  */
158
- export class RunningSessions extends ReactWidget {
261
+ export class RunningSessions extends SidePanel {
159
262
  /**
160
263
  * Construct a new running widget.
161
264
  */
162
265
  constructor(managers, translator) {
163
266
  super();
164
267
  this.managers = managers;
165
- this.translator = translator || nullTranslator;
166
- // 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');
167
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);
168
278
  }
169
- render() {
170
- 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 }));
171
297
  }
172
298
  }
173
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,E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G,EAAE,CACZ,QAAQ,CAAC,KAAK,EAAE,CAAC,OAAO,CAAC,OAAO,CAAC,EAAE,CAAC,OAAO,CAAC,cAAc,EAAE,CAAC;SAChE,CAAC,CACH,CAAC;QAEF,QAAQ,CAAC,KAAK,EAAE,CAAC,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.2",
3
+ "version": "4.0.0-alpha.21",
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.2",
40
- "@jupyterlab/translation": "^4.0.0-alpha.2",
41
- "@jupyterlab/ui-components": "^4.0.0-alpha.17",
42
- "@lumino/coreutils": "^1.11.1",
43
- "@lumino/disposable": "^1.10.1",
44
- "@lumino/signaling": "^1.10.1",
45
- "react": "^17.0.1"
40
+ "@jupyterlab/apputils": "^4.0.0-alpha.21",
41
+ "@jupyterlab/translation": "^4.0.0-alpha.21",
42
+ "@jupyterlab/ui-components": "^4.0.0-alpha.36",
43
+ "@lumino/coreutils": "^2.0.0-rc.1",
44
+ "@lumino/disposable": "^2.0.0-rc.1",
45
+ "@lumino/messaging": "^2.0.0-rc.1",
46
+ "@lumino/signaling": "^2.0.0-rc.1",
47
+ "@lumino/widgets": "^2.0.0-rc.1",
48
+ "react": "^18.2.0"
46
49
  },
47
50
  "devDependencies": {
48
51
  "rimraf": "~3.0.0",
49
- "typedoc": "~0.21.2",
50
- "typescript": "~4.5.2"
52
+ "typedoc": "~0.23.25",
53
+ "typescript": "~5.0.1-rc"
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
  /*-----------------------------------------------------------------------------
@@ -20,57 +22,29 @@
20
22
  min-width: var(--jp-sidebar-min-width);
21
23
  color: var(--jp-ui-font-color1);
22
24
  background: var(--jp-layout-color1);
25
+
23
26
  /* This is needed so that all font sizing of children done in ems is
24
27
  * relative to this base size */
25
28
  font-size: var(--jp-ui-font-size1);
26
29
  }
27
30
 
28
- .jp-RunningSessions-header {
29
- flex: 0 0 auto;
30
- display: flex;
31
- flex-direction: row;
31
+ .jp-RunningSessions > .jp-SidePanel-toolbar {
32
32
  justify-content: flex-end;
33
33
  }
34
34
 
35
35
  .jp-RunningSessions-section {
36
- display: flex;
37
- flex: 0 1 auto;
38
- flex-direction: column;
36
+ min-height: 50px;
39
37
  overflow: auto;
40
38
  }
41
39
 
42
- .jp-RunningSessions-sectionHeader {
43
- flex: 0 0 auto;
44
- align-items: center;
45
- justify-content: space-between;
46
- height: 28px;
47
- display: flex;
48
- border-bottom: var(--jp-border-width) solid var(--jp-border-color2);
49
- margin-top: 8px;
50
- }
51
-
52
- .jp-RunningSessions-sectionHeader h2 {
53
- flex: 0 0 auto;
54
- font-weight: 600;
55
- text-transform: uppercase;
56
- letter-spacing: 1px;
57
- font-size: var(--jp-ui-font-size0);
58
- padding: 8px 8px 8px 12px;
59
- margin: 0px;
60
- }
61
-
62
- .jp-RunningSessions-sectionHeader .jp-ToolbarButtonComponent {
63
- flex: 0 0 auto;
64
- }
65
-
66
40
  .jp-RunningSessions-sectionContainer {
67
- flex: 1 1 auto;
68
41
  margin: 0;
69
42
  padding: 0;
70
43
  overflow: auto;
71
44
  }
72
45
 
73
46
  .jp-RunningSessions-sectionList {
47
+ display: block;
74
48
  margin: 0;
75
49
  padding: 0;
76
50
  list-style-type: none;
@@ -82,17 +56,26 @@
82
56
  color: var(--jp-ui-font-color1);
83
57
  height: var(--jp-private-running-item-height);
84
58
  line-height: var(--jp-private-running-item-height);
85
- padding: 0 8px 0 8px;
59
+ padding: 0 8px;
86
60
  }
87
61
 
88
62
  .jp-RunningSessions-item:hover {
89
63
  background-color: var(--jp-layout-color2);
90
64
  }
91
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
+
92
75
  .jp-RunningSessions-itemLabel {
93
76
  font-size: var(--jp-ui-font-size1);
94
77
  flex: 1 1 55%;
95
- padding: 0 4px 0 4px;
78
+ padding: 0 4px;
96
79
  text-overflow: ellipsis;
97
80
  overflow: hidden;
98
81
  white-space: nowrap;
@@ -105,19 +88,18 @@
105
88
  .jp-RunningSessions-itemDetail {
106
89
  font-size: var(--jp-ui-font-size1);
107
90
  flex: 1 1 45%;
108
- padding: 0 4px 0 4px;
91
+ padding: 0 4px;
109
92
  text-overflow: ellipsis;
110
93
  overflow: hidden;
111
94
  white-space: nowrap;
112
95
  }
113
96
 
114
97
  .jp-RunningSessions-item .jp-RunningSessions-itemShutdown {
115
- border-radius: 0px;
98
+ border-radius: 0;
116
99
  }
117
100
 
118
101
  .jp-RunningSessions-item:not(:hover) .jp-RunningSessions-itemShutdown {
119
102
  visibility: hidden;
120
- /* display: none; */
121
103
  }
122
104
 
123
105
  .jp-RunningSessions-sectionList
@@ -126,32 +108,34 @@
126
108
  background: var(--jp-layout-color3);
127
109
  }
128
110
 
129
- .jp-RunningSessions-shutdownAll.jp-mod-styled {
130
- margin: 0px 8px;
111
+ .jp-RunningSessions-shutdownAll.jp-mod-styled
112
+ > .jp-ToolbarButtonComponent-label {
131
113
  color: var(--jp-warn-color1);
132
114
  background-color: transparent;
133
- height: var(--jp-private-running-shutdown-button-height);
134
- line-height: var(--jp-private-running-shutdown-button-height);
135
115
  border-radius: 2px;
136
116
  overflow: hidden;
137
117
  white-space: nowrap;
138
118
  text-overflow: ellipsis;
139
119
  }
140
120
 
141
- .jp-RunningSessions-shutdownAll.jp-mod-styled:hover {
121
+ .jp-RunningSessions-shutdownAll.jp-mod-styled:hover
122
+ > .jp-ToolbarButtonComponent-label {
142
123
  background-color: var(--jp-layout-color2);
143
124
  }
144
125
 
145
- .jp-RunningSessions-shutdownAll.jp-mod-styled:focus {
126
+ .jp-RunningSessions-shutdownAll.jp-mod-styled:focus
127
+ > .jp-ToolbarButtonComponent-label {
146
128
  border: none;
147
129
  box-shadow: none;
148
130
  background-color: var(--jp-layout-color2);
149
131
  }
150
132
 
151
- .jp-RunningSessions-shutdownAll.jp-mod-styled.jp-mod-disabled {
133
+ .jp-RunningSessions-shutdownAll.jp-mod-styled.jp-mod-disabled
134
+ > .jp-ToolbarButtonComponent-label {
152
135
  color: var(--jp-ui-font-color2);
153
136
  }
154
137
 
155
- .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 {
156
140
  background: none;
157
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