@jupyterlab/pluginmanager 4.1.0-alpha.2
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/dialogs.d.ts +13 -0
- package/lib/dialogs.js +14 -0
- package/lib/dialogs.js.map +1 -0
- package/lib/index.d.ts +7 -0
- package/lib/index.js +12 -0
- package/lib/index.js.map +1 -0
- package/lib/model.d.ts +180 -0
- package/lib/model.js +322 -0
- package/lib/model.js.map +1 -0
- package/lib/tokens.d.ts +14 -0
- package/lib/tokens.js +8 -0
- package/lib/tokens.js.map +1 -0
- package/lib/widget.d.ts +23 -0
- package/lib/widget.js +184 -0
- package/lib/widget.js.map +1 -0
- package/package.json +64 -0
- package/src/dialogs.tsx +47 -0
- package/src/index.ts +11 -0
- package/src/model.ts +478 -0
- package/src/tokens.ts +22 -0
- package/src/widget.tsx +314 -0
- package/style/base.css +31 -0
- package/style/index.css +11 -0
- package/style/index.js +12 -0
package/lib/dialogs.d.ts
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { JupyterLab } from '@jupyterlab/application';
|
|
2
|
+
import { TranslationBundle } from '@jupyterlab/translation';
|
|
3
|
+
import * as React from 'react';
|
|
4
|
+
export declare function PluginRequiredMessage(props: {
|
|
5
|
+
plugin: JupyterLab.IPluginInfo;
|
|
6
|
+
dependants: JupyterLab.IPluginInfo[];
|
|
7
|
+
trans: TranslationBundle;
|
|
8
|
+
}): React.ReactElement<any>;
|
|
9
|
+
export declare function PluginInUseMessage(props: {
|
|
10
|
+
plugin: JupyterLab.IPluginInfo;
|
|
11
|
+
optionalDependants: JupyterLab.IPluginInfo[];
|
|
12
|
+
trans: TranslationBundle;
|
|
13
|
+
}): React.ReactElement<any>;
|
package/lib/dialogs.js
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
export function PluginRequiredMessage(props) {
|
|
3
|
+
return (React.createElement(React.Fragment, null,
|
|
4
|
+
props.trans.__('The plugin "%1" cannot be disabled as it is required by other plugins:', props.plugin.id),
|
|
5
|
+
React.createElement("ul", null, props.dependants.map(plugin => (React.createElement("li", { key: 'dependantsDialog-' + plugin.id }, plugin.id)))),
|
|
6
|
+
props.trans.__('Please disable the dependant plugins first.')));
|
|
7
|
+
}
|
|
8
|
+
export function PluginInUseMessage(props) {
|
|
9
|
+
return (React.createElement("div", { className: 'jp-pluginmanager-PluginInUseMessage' },
|
|
10
|
+
props.trans.__('While the plugin "%1" is not required by other enabled plugins, some plugins provide optional features depending on it. These plugins are:', props.plugin.id),
|
|
11
|
+
React.createElement("ul", null, props.optionalDependants.map(plugin => (React.createElement("li", { key: 'optionalDependantsDialog-' + plugin.id }, plugin.id)))),
|
|
12
|
+
props.trans.__('Do you want to disable it anyway?')));
|
|
13
|
+
}
|
|
14
|
+
//# sourceMappingURL=dialogs.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dialogs.js","sourceRoot":"","sources":["../src/dialogs.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,MAAM,UAAU,qBAAqB,CAAC,KAIrC;IACC,OAAO,CACL;QACG,KAAK,CAAC,KAAK,CAAC,EAAE,CACb,wEAAwE,EACxE,KAAK,CAAC,MAAM,CAAC,EAAE,CAChB;QACD,gCACG,KAAK,CAAC,UAAU,CAAC,GAAG,CAAC,MAAM,CAAC,EAAE,CAAC,CAC9B,4BAAI,GAAG,EAAE,mBAAmB,GAAG,MAAM,CAAC,EAAE,IAAG,MAAM,CAAC,EAAE,CAAM,CAC3D,CAAC,CACC;QACJ,KAAK,CAAC,KAAK,CAAC,EAAE,CAAC,6CAA6C,CAAC,CAC7D,CACJ,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,kBAAkB,CAAC,KAIlC;IACC,OAAO,CACL,6BAAK,SAAS,EAAE,qCAAqC;QAClD,KAAK,CAAC,KAAK,CAAC,EAAE,CACb,4IAA4I,EAC5I,KAAK,CAAC,MAAM,CAAC,EAAE,CAChB;QACD,gCACG,KAAK,CAAC,kBAAkB,CAAC,GAAG,CAAC,MAAM,CAAC,EAAE,CAAC,CACtC,4BAAI,GAAG,EAAE,2BAA2B,GAAG,MAAM,CAAC,EAAE,IAAG,MAAM,CAAC,EAAE,CAAM,CACnE,CAAC,CACC;QACJ,KAAK,CAAC,KAAK,CAAC,EAAE,CAAC,mCAAmC,CAAC,CAChD,CACP,CAAC;AACJ,CAAC"}
|
package/lib/index.d.ts
ADDED
package/lib/index.js
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/* -----------------------------------------------------------------------------
|
|
2
|
+
| Copyright (c) Jupyter Development Team.
|
|
3
|
+
| Distributed under the terms of the Modified BSD License.
|
|
4
|
+
|----------------------------------------------------------------------------*/
|
|
5
|
+
/**
|
|
6
|
+
* @packageDocumentation
|
|
7
|
+
* @module pluginmanager
|
|
8
|
+
*/
|
|
9
|
+
export * from './model';
|
|
10
|
+
export * from './widget';
|
|
11
|
+
export * from './tokens';
|
|
12
|
+
//# sourceMappingURL=index.js.map
|
package/lib/index.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;+EAG+E;AAC/E;;;GAGG;AACH,cAAc,SAAS,CAAC;AACxB,cAAc,UAAU,CAAC;AACzB,cAAc,UAAU,CAAC"}
|
package/lib/model.d.ts
ADDED
|
@@ -0,0 +1,180 @@
|
|
|
1
|
+
import type { JupyterLab } from '@jupyterlab/application';
|
|
2
|
+
import { ServerConnection } from '@jupyterlab/services';
|
|
3
|
+
import { VDomModel } from '@jupyterlab/ui-components';
|
|
4
|
+
import { ISignal } from '@lumino/signaling';
|
|
5
|
+
import { ITranslator } from '@jupyterlab/translation';
|
|
6
|
+
/**
|
|
7
|
+
* Extension actions that the server API accepts.
|
|
8
|
+
*/
|
|
9
|
+
export type Action = 'enable' | 'disable';
|
|
10
|
+
/**
|
|
11
|
+
* Information about a plugin.
|
|
12
|
+
*/
|
|
13
|
+
export interface IEntry extends JupyterLab.IPluginInfo {
|
|
14
|
+
/**
|
|
15
|
+
* Whether the plugin is locked (cannot be enabled/disabled).
|
|
16
|
+
*
|
|
17
|
+
* Administrators can lock plugins preventing users from introducing modifications.
|
|
18
|
+
* The check is performed on the server side, this field is only to show users
|
|
19
|
+
* an indicator of the lock status.
|
|
20
|
+
*/
|
|
21
|
+
readonly locked: boolean;
|
|
22
|
+
/**
|
|
23
|
+
* Token name (if any) excluding the plugin prefix (unless none)
|
|
24
|
+
*/
|
|
25
|
+
tokenLabel?: string;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* An object representing a server reply to performing an action.
|
|
29
|
+
*/
|
|
30
|
+
export interface IActionReply {
|
|
31
|
+
/**
|
|
32
|
+
* The status category of the reply.
|
|
33
|
+
*/
|
|
34
|
+
status: 'ok' | 'warning' | 'error' | null;
|
|
35
|
+
/**
|
|
36
|
+
* An optional message when the status is not 'ok'.
|
|
37
|
+
*/
|
|
38
|
+
message?: string;
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* The namespace for PluginListModel.
|
|
42
|
+
*/
|
|
43
|
+
export declare namespace PluginListModel {
|
|
44
|
+
interface IConfigurableState {
|
|
45
|
+
/**
|
|
46
|
+
* The plugin list search query.
|
|
47
|
+
*/
|
|
48
|
+
query?: string;
|
|
49
|
+
/**
|
|
50
|
+
* Whether the warning is disclaimed or not.
|
|
51
|
+
*/
|
|
52
|
+
isDisclaimed?: boolean;
|
|
53
|
+
}
|
|
54
|
+
/** A subset of `JupyterLab.IInfo` interface (defined to reduce API surface) */
|
|
55
|
+
interface IPluginData {
|
|
56
|
+
readonly availablePlugins: JupyterLab.IPluginInfo[];
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* The initialization options for a plugins list model.
|
|
60
|
+
*/
|
|
61
|
+
interface IOptions extends IConfigurableState {
|
|
62
|
+
/**
|
|
63
|
+
* Plugin data.
|
|
64
|
+
*/
|
|
65
|
+
pluginData: IPluginData;
|
|
66
|
+
/**
|
|
67
|
+
* Translator.
|
|
68
|
+
*/
|
|
69
|
+
translator?: ITranslator;
|
|
70
|
+
/**
|
|
71
|
+
* Server connection settings.
|
|
72
|
+
*/
|
|
73
|
+
serverSettings?: ServerConnection.ISettings;
|
|
74
|
+
/**
|
|
75
|
+
* Additional plugins to lock in addition to plugins locked on the server-side.
|
|
76
|
+
*
|
|
77
|
+
* This is intended exclusively to protect user from shooting themselves in
|
|
78
|
+
* the foot by accidentally disabling the plugin manager or other core plugins
|
|
79
|
+
* (which would mean they cannot recover) and is not enforced on server side.
|
|
80
|
+
*/
|
|
81
|
+
extraLockedPlugins?: string[];
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
/**
|
|
85
|
+
* The model representing plugin list.
|
|
86
|
+
*/
|
|
87
|
+
export declare class PluginListModel extends VDomModel {
|
|
88
|
+
constructor(options: PluginListModel.IOptions);
|
|
89
|
+
get available(): ReadonlyArray<IEntry>;
|
|
90
|
+
/**
|
|
91
|
+
* Contains an error message if an error occurred when querying plugin status.
|
|
92
|
+
*/
|
|
93
|
+
statusError: string | null;
|
|
94
|
+
/**
|
|
95
|
+
* Contains an error message if an error occurred when enabling/disabling plugin.
|
|
96
|
+
*/
|
|
97
|
+
actionError: string | null;
|
|
98
|
+
/**
|
|
99
|
+
* Whether plugin data is still getting loaded.
|
|
100
|
+
*/
|
|
101
|
+
get isLoading(): boolean;
|
|
102
|
+
/**
|
|
103
|
+
* Whether the warning is disclaimed or not.
|
|
104
|
+
*/
|
|
105
|
+
get isDisclaimed(): boolean;
|
|
106
|
+
set isDisclaimed(v: boolean);
|
|
107
|
+
/**
|
|
108
|
+
* The search query.
|
|
109
|
+
*
|
|
110
|
+
* Setting its value triggers a new search.
|
|
111
|
+
*/
|
|
112
|
+
get query(): string;
|
|
113
|
+
set query(value: string);
|
|
114
|
+
/**
|
|
115
|
+
* A promise that resolves when the trackable data changes
|
|
116
|
+
*/
|
|
117
|
+
get trackerDataChanged(): ISignal<PluginListModel, void>;
|
|
118
|
+
/**
|
|
119
|
+
* A promise that resolves when the plugins were fetched from the server
|
|
120
|
+
*/
|
|
121
|
+
get ready(): Promise<void>;
|
|
122
|
+
/**
|
|
123
|
+
* Enable a plugin.
|
|
124
|
+
*
|
|
125
|
+
* @param entry An entry indicating which plugin to enable.
|
|
126
|
+
*/
|
|
127
|
+
enable(entry: IEntry): Promise<void>;
|
|
128
|
+
/**
|
|
129
|
+
* Disable a plugin.
|
|
130
|
+
*
|
|
131
|
+
* @param entry An entry indicating which plugin to disable.
|
|
132
|
+
* @returns Whether the plugin was disabled
|
|
133
|
+
*/
|
|
134
|
+
disable(entry: IEntry): Promise<void>;
|
|
135
|
+
protected getDependants(entry: IEntry): {
|
|
136
|
+
dependants: IEntry[];
|
|
137
|
+
optionalDependants: IEntry[];
|
|
138
|
+
};
|
|
139
|
+
/**
|
|
140
|
+
* Whether there are currently any actions pending.
|
|
141
|
+
*/
|
|
142
|
+
hasPendingActions(): boolean;
|
|
143
|
+
/**
|
|
144
|
+
* Send a request to the server to perform an action on a plugin.
|
|
145
|
+
*
|
|
146
|
+
* @param action A valid action to perform.
|
|
147
|
+
* @param entry The plugin to perform the action on.
|
|
148
|
+
*/
|
|
149
|
+
private _performAction;
|
|
150
|
+
/**
|
|
151
|
+
* Add a pending action.
|
|
152
|
+
*
|
|
153
|
+
* @param pending A promise that resolves when the action is completed.
|
|
154
|
+
*/
|
|
155
|
+
private _addPendingAction;
|
|
156
|
+
/**
|
|
157
|
+
* Refresh plugin lock statuses
|
|
158
|
+
*/
|
|
159
|
+
refresh(): Promise<void>;
|
|
160
|
+
private _isLocked;
|
|
161
|
+
/**
|
|
162
|
+
* Call the plugin API
|
|
163
|
+
*
|
|
164
|
+
* @param endPoint API REST end point for the plugin
|
|
165
|
+
* @param init Initial values for the request
|
|
166
|
+
* @returns The response body interpreted as JSON
|
|
167
|
+
*/
|
|
168
|
+
private _requestAPI;
|
|
169
|
+
private _trackerDataChanged;
|
|
170
|
+
private _available;
|
|
171
|
+
private _isLoading;
|
|
172
|
+
private _pendingActions;
|
|
173
|
+
private _serverSettings;
|
|
174
|
+
private _ready;
|
|
175
|
+
private _query;
|
|
176
|
+
private _pluginData;
|
|
177
|
+
private _extraLockedPlugins;
|
|
178
|
+
private _trans;
|
|
179
|
+
private _isDisclaimed;
|
|
180
|
+
}
|
package/lib/model.js
ADDED
|
@@ -0,0 +1,322 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) Jupyter Development Team.
|
|
3
|
+
* Distributed under the terms of the Modified BSD License.
|
|
4
|
+
*/
|
|
5
|
+
import { Dialog, showDialog } from '@jupyterlab/apputils';
|
|
6
|
+
import { URLExt } from '@jupyterlab/coreutils';
|
|
7
|
+
import { ServerConnection } from '@jupyterlab/services';
|
|
8
|
+
import { VDomModel } from '@jupyterlab/ui-components';
|
|
9
|
+
import { Signal } from '@lumino/signaling';
|
|
10
|
+
import { PromiseDelegate } from '@lumino/coreutils';
|
|
11
|
+
import { nullTranslator } from '@jupyterlab/translation';
|
|
12
|
+
import { PluginInUseMessage, PluginRequiredMessage } from './dialogs';
|
|
13
|
+
/**
|
|
14
|
+
* The server API path for querying/modifying available plugins.
|
|
15
|
+
*/
|
|
16
|
+
const PLUGIN_API_PATH = 'lab/api/plugins';
|
|
17
|
+
/**
|
|
18
|
+
* The model representing plugin list.
|
|
19
|
+
*/
|
|
20
|
+
export class PluginListModel extends VDomModel {
|
|
21
|
+
constructor(options) {
|
|
22
|
+
var _a, _b, _c;
|
|
23
|
+
super();
|
|
24
|
+
/**
|
|
25
|
+
* Contains an error message if an error occurred when querying plugin status.
|
|
26
|
+
*/
|
|
27
|
+
this.statusError = null;
|
|
28
|
+
/**
|
|
29
|
+
* Contains an error message if an error occurred when enabling/disabling plugin.
|
|
30
|
+
*/
|
|
31
|
+
this.actionError = null;
|
|
32
|
+
this._trackerDataChanged = new Signal(this);
|
|
33
|
+
this._isLoading = false;
|
|
34
|
+
this._pendingActions = [];
|
|
35
|
+
this._ready = new PromiseDelegate();
|
|
36
|
+
this._pluginData = options.pluginData;
|
|
37
|
+
this._serverSettings =
|
|
38
|
+
options.serverSettings || ServerConnection.makeSettings();
|
|
39
|
+
this._query = options.query || '';
|
|
40
|
+
this._isDisclaimed = (_a = options.isDisclaimed) !== null && _a !== void 0 ? _a : false;
|
|
41
|
+
this._extraLockedPlugins = (_b = options.extraLockedPlugins) !== null && _b !== void 0 ? _b : [];
|
|
42
|
+
this.refresh()
|
|
43
|
+
.then(() => this._ready.resolve())
|
|
44
|
+
.catch(e => this._ready.reject(e));
|
|
45
|
+
this._trans = ((_c = options.translator) !== null && _c !== void 0 ? _c : nullTranslator).load('jupyterlab');
|
|
46
|
+
}
|
|
47
|
+
get available() {
|
|
48
|
+
return [...this._available.values()];
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Whether plugin data is still getting loaded.
|
|
52
|
+
*/
|
|
53
|
+
get isLoading() {
|
|
54
|
+
return this._isLoading;
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* Whether the warning is disclaimed or not.
|
|
58
|
+
*/
|
|
59
|
+
get isDisclaimed() {
|
|
60
|
+
return this._isDisclaimed;
|
|
61
|
+
}
|
|
62
|
+
set isDisclaimed(v) {
|
|
63
|
+
if (v !== this._isDisclaimed) {
|
|
64
|
+
this._isDisclaimed = v;
|
|
65
|
+
this.stateChanged.emit();
|
|
66
|
+
this._trackerDataChanged.emit(void 0);
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* The search query.
|
|
71
|
+
*
|
|
72
|
+
* Setting its value triggers a new search.
|
|
73
|
+
*/
|
|
74
|
+
get query() {
|
|
75
|
+
return this._query;
|
|
76
|
+
}
|
|
77
|
+
set query(value) {
|
|
78
|
+
if (this._query !== value) {
|
|
79
|
+
this._query = value;
|
|
80
|
+
this.stateChanged.emit();
|
|
81
|
+
this._trackerDataChanged.emit(void 0);
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
/**
|
|
85
|
+
* A promise that resolves when the trackable data changes
|
|
86
|
+
*/
|
|
87
|
+
get trackerDataChanged() {
|
|
88
|
+
return this._trackerDataChanged;
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* A promise that resolves when the plugins were fetched from the server
|
|
92
|
+
*/
|
|
93
|
+
get ready() {
|
|
94
|
+
return this._ready.promise;
|
|
95
|
+
}
|
|
96
|
+
/**
|
|
97
|
+
* Enable a plugin.
|
|
98
|
+
*
|
|
99
|
+
* @param entry An entry indicating which plugin to enable.
|
|
100
|
+
*/
|
|
101
|
+
async enable(entry) {
|
|
102
|
+
if (!this.isDisclaimed) {
|
|
103
|
+
throw new Error('User has not confirmed the disclaimer');
|
|
104
|
+
}
|
|
105
|
+
await this._performAction('enable', entry);
|
|
106
|
+
entry.enabled = true;
|
|
107
|
+
}
|
|
108
|
+
/**
|
|
109
|
+
* Disable a plugin.
|
|
110
|
+
*
|
|
111
|
+
* @param entry An entry indicating which plugin to disable.
|
|
112
|
+
* @returns Whether the plugin was disabled
|
|
113
|
+
*/
|
|
114
|
+
async disable(entry) {
|
|
115
|
+
if (!this.isDisclaimed) {
|
|
116
|
+
throw new Error('User has not confirmed the disclaimer');
|
|
117
|
+
}
|
|
118
|
+
const { dependants, optionalDependants } = this.getDependants(entry);
|
|
119
|
+
if (dependants.length > 0) {
|
|
120
|
+
// We require user to disable plugins one-by-one as each of them may have
|
|
121
|
+
// further dependencies (or optional dependencies) and we want the user to
|
|
122
|
+
// take a pause to think about those.
|
|
123
|
+
void showDialog({
|
|
124
|
+
title: this._trans.__('This plugin is required by other plugins'),
|
|
125
|
+
body: PluginRequiredMessage({
|
|
126
|
+
plugin: entry,
|
|
127
|
+
dependants,
|
|
128
|
+
trans: this._trans
|
|
129
|
+
}),
|
|
130
|
+
buttons: [Dialog.okButton()]
|
|
131
|
+
});
|
|
132
|
+
return;
|
|
133
|
+
}
|
|
134
|
+
if (optionalDependants.length > 0) {
|
|
135
|
+
const userConfirmation = await showDialog({
|
|
136
|
+
title: this._trans.__('This plugin is used by other plugins'),
|
|
137
|
+
body: PluginInUseMessage({
|
|
138
|
+
plugin: entry,
|
|
139
|
+
optionalDependants,
|
|
140
|
+
trans: this._trans
|
|
141
|
+
}),
|
|
142
|
+
buttons: [
|
|
143
|
+
Dialog.okButton({ label: this._trans.__('Disable anyway') }),
|
|
144
|
+
Dialog.cancelButton()
|
|
145
|
+
]
|
|
146
|
+
});
|
|
147
|
+
if (!userConfirmation.button.accept) {
|
|
148
|
+
return;
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
await this._performAction('disable', entry);
|
|
152
|
+
if (this.actionError) {
|
|
153
|
+
return;
|
|
154
|
+
}
|
|
155
|
+
entry.enabled = false;
|
|
156
|
+
}
|
|
157
|
+
getDependants(entry) {
|
|
158
|
+
const dependants = [];
|
|
159
|
+
const optionalDependants = [];
|
|
160
|
+
if (entry.provides) {
|
|
161
|
+
const tokenName = entry.provides.name;
|
|
162
|
+
for (const plugin of this._available.values()) {
|
|
163
|
+
if (!plugin.enabled) {
|
|
164
|
+
continue;
|
|
165
|
+
}
|
|
166
|
+
if (plugin.requires
|
|
167
|
+
.filter(token => !!token)
|
|
168
|
+
.some(token => token.name === tokenName)) {
|
|
169
|
+
dependants.push(plugin);
|
|
170
|
+
}
|
|
171
|
+
if (plugin.optional
|
|
172
|
+
.filter(token => !!token)
|
|
173
|
+
.some(token => token.name === tokenName)) {
|
|
174
|
+
optionalDependants.push(plugin);
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
return {
|
|
179
|
+
dependants,
|
|
180
|
+
optionalDependants
|
|
181
|
+
};
|
|
182
|
+
}
|
|
183
|
+
/**
|
|
184
|
+
* Whether there are currently any actions pending.
|
|
185
|
+
*/
|
|
186
|
+
hasPendingActions() {
|
|
187
|
+
return this._pendingActions.length > 0;
|
|
188
|
+
}
|
|
189
|
+
/**
|
|
190
|
+
* Send a request to the server to perform an action on a plugin.
|
|
191
|
+
*
|
|
192
|
+
* @param action A valid action to perform.
|
|
193
|
+
* @param entry The plugin to perform the action on.
|
|
194
|
+
*/
|
|
195
|
+
_performAction(action, entry) {
|
|
196
|
+
this.actionError = null;
|
|
197
|
+
const actionRequest = this._requestAPI({}, {
|
|
198
|
+
method: 'POST',
|
|
199
|
+
body: JSON.stringify({
|
|
200
|
+
cmd: action,
|
|
201
|
+
plugin_name: entry.id
|
|
202
|
+
})
|
|
203
|
+
});
|
|
204
|
+
actionRequest.catch(reason => {
|
|
205
|
+
this.actionError = reason.toString();
|
|
206
|
+
});
|
|
207
|
+
this._addPendingAction(actionRequest);
|
|
208
|
+
return actionRequest;
|
|
209
|
+
}
|
|
210
|
+
/**
|
|
211
|
+
* Add a pending action.
|
|
212
|
+
*
|
|
213
|
+
* @param pending A promise that resolves when the action is completed.
|
|
214
|
+
*/
|
|
215
|
+
_addPendingAction(pending) {
|
|
216
|
+
// Add to pending actions collection
|
|
217
|
+
this._pendingActions.push(pending);
|
|
218
|
+
// Ensure action is removed when resolved
|
|
219
|
+
const remove = () => {
|
|
220
|
+
const i = this._pendingActions.indexOf(pending);
|
|
221
|
+
this._pendingActions.splice(i, 1);
|
|
222
|
+
this.stateChanged.emit(undefined);
|
|
223
|
+
};
|
|
224
|
+
pending.then(remove, remove);
|
|
225
|
+
// Signal changed state
|
|
226
|
+
this.stateChanged.emit(undefined);
|
|
227
|
+
}
|
|
228
|
+
/**
|
|
229
|
+
* Refresh plugin lock statuses
|
|
230
|
+
*/
|
|
231
|
+
async refresh() {
|
|
232
|
+
var _a;
|
|
233
|
+
this.statusError = null;
|
|
234
|
+
this._isLoading = true;
|
|
235
|
+
this.stateChanged.emit();
|
|
236
|
+
try {
|
|
237
|
+
// Get the lock status from backend; if backend is not available,
|
|
238
|
+
// we assume that all plugins are locked.
|
|
239
|
+
const fallback = {
|
|
240
|
+
allLocked: true,
|
|
241
|
+
lockRules: []
|
|
242
|
+
};
|
|
243
|
+
const status = (_a = (await this._requestAPI())) !== null && _a !== void 0 ? _a : fallback;
|
|
244
|
+
this._available = new Map(this._pluginData.availablePlugins.map(plugin => {
|
|
245
|
+
let tokenLabel = plugin.provides
|
|
246
|
+
? plugin.provides.name.split(':')[1]
|
|
247
|
+
: undefined;
|
|
248
|
+
if (plugin.provides && !tokenLabel) {
|
|
249
|
+
tokenLabel = plugin.provides.name;
|
|
250
|
+
}
|
|
251
|
+
return [
|
|
252
|
+
plugin.id,
|
|
253
|
+
{
|
|
254
|
+
...plugin,
|
|
255
|
+
locked: this._isLocked(plugin.id, status),
|
|
256
|
+
tokenLabel
|
|
257
|
+
}
|
|
258
|
+
];
|
|
259
|
+
}));
|
|
260
|
+
}
|
|
261
|
+
catch (reason) {
|
|
262
|
+
this.statusError = reason.toString();
|
|
263
|
+
}
|
|
264
|
+
finally {
|
|
265
|
+
this._isLoading = false;
|
|
266
|
+
this.stateChanged.emit();
|
|
267
|
+
}
|
|
268
|
+
}
|
|
269
|
+
_isLocked(pluginId, status) {
|
|
270
|
+
if (status.allLocked) {
|
|
271
|
+
// All plugins are locked.
|
|
272
|
+
return true;
|
|
273
|
+
}
|
|
274
|
+
if (this._extraLockedPlugins.includes(pluginId)) {
|
|
275
|
+
// Plugin is locked on client side.
|
|
276
|
+
return true;
|
|
277
|
+
}
|
|
278
|
+
const extension = pluginId.split(':')[0];
|
|
279
|
+
if (status.lockRules.includes(extension)) {
|
|
280
|
+
// Entire extension is locked.
|
|
281
|
+
return true;
|
|
282
|
+
}
|
|
283
|
+
if (status.lockRules.includes(pluginId)) {
|
|
284
|
+
// This plugin specifically is locked.
|
|
285
|
+
return true;
|
|
286
|
+
}
|
|
287
|
+
return false;
|
|
288
|
+
}
|
|
289
|
+
/**
|
|
290
|
+
* Call the plugin API
|
|
291
|
+
*
|
|
292
|
+
* @param endPoint API REST end point for the plugin
|
|
293
|
+
* @param init Initial values for the request
|
|
294
|
+
* @returns The response body interpreted as JSON
|
|
295
|
+
*/
|
|
296
|
+
async _requestAPI(queryArgs = {}, init = {}) {
|
|
297
|
+
// Make request to Jupyter API
|
|
298
|
+
const settings = this._serverSettings;
|
|
299
|
+
const requestUrl = URLExt.join(settings.baseUrl, PLUGIN_API_PATH);
|
|
300
|
+
let response;
|
|
301
|
+
try {
|
|
302
|
+
response = await ServerConnection.makeRequest(requestUrl + URLExt.objectToQueryString(queryArgs), init, settings);
|
|
303
|
+
}
|
|
304
|
+
catch (error) {
|
|
305
|
+
throw new ServerConnection.NetworkError(error);
|
|
306
|
+
}
|
|
307
|
+
let data = await response.text();
|
|
308
|
+
if (data.length > 0) {
|
|
309
|
+
try {
|
|
310
|
+
data = JSON.parse(data);
|
|
311
|
+
}
|
|
312
|
+
catch (error) {
|
|
313
|
+
console.log('Not a JSON response body.', response);
|
|
314
|
+
}
|
|
315
|
+
}
|
|
316
|
+
if (!response.ok) {
|
|
317
|
+
throw new ServerConnection.ResponseError(response, data.message || data);
|
|
318
|
+
}
|
|
319
|
+
return data;
|
|
320
|
+
}
|
|
321
|
+
}
|
|
322
|
+
//# sourceMappingURL=model.js.map
|
package/lib/model.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"model.js","sourceRoot":"","sources":["../src/model.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAC1D,OAAO,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AAC/C,OAAO,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AACxD,OAAO,EAAE,SAAS,EAAE,MAAM,2BAA2B,CAAC;AACtD,OAAO,EAAW,MAAM,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAEL,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C1E;QAED,OAAO,IAAI,CAAC;IACd,CAAC;CAaF"}
|
package/lib/tokens.d.ts
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { Token } from '@lumino/coreutils';
|
|
2
|
+
/**
|
|
3
|
+
* The plugin manager token.
|
|
4
|
+
*/
|
|
5
|
+
export declare const IPluginManager: Token<IPluginManager>;
|
|
6
|
+
/**
|
|
7
|
+
* A class that exposes a command to open plugin manager.
|
|
8
|
+
*/
|
|
9
|
+
export interface IPluginManager {
|
|
10
|
+
/**
|
|
11
|
+
* Open the plugin manager.
|
|
12
|
+
*/
|
|
13
|
+
open(): Promise<void>;
|
|
14
|
+
}
|
package/lib/tokens.js
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
// Copyright (c) Jupyter Development Team.
|
|
2
|
+
// Distributed under the terms of the Modified BSD License.
|
|
3
|
+
import { Token } from '@lumino/coreutils';
|
|
4
|
+
/**
|
|
5
|
+
* The plugin manager token.
|
|
6
|
+
*/
|
|
7
|
+
export const IPluginManager = new Token('@jupyterlab/pluginmanager:IPluginManager', `A canary for plugin manager presence, with a method to open the plugin manager widget.`);
|
|
8
|
+
//# sourceMappingURL=tokens.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tokens.js","sourceRoot":"","sources":["../src/tokens.ts"],"names":[],"mappings":"AAAA,0CAA0C;AAC1C,2DAA2D;AAE3D,OAAO,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAE1C;;GAEG;AACH,MAAM,CAAC,MAAM,cAAc,GAAG,IAAI,KAAK,CACrC,0CAA0C,EAC1C,wFAAwF,CACzF,CAAC"}
|
package/lib/widget.d.ts
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { ITranslator, TranslationBundle } from '@jupyterlab/translation';
|
|
2
|
+
import { Panel } from '@lumino/widgets';
|
|
3
|
+
import { PluginListModel } from './model';
|
|
4
|
+
/**
|
|
5
|
+
* A namespace for plugins panel.
|
|
6
|
+
*/
|
|
7
|
+
export declare namespace Plugins {
|
|
8
|
+
/**
|
|
9
|
+
* The initialization options for a plugins panel.
|
|
10
|
+
*/
|
|
11
|
+
interface IOptions {
|
|
12
|
+
model: PluginListModel;
|
|
13
|
+
translator: ITranslator;
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Panel with a table of available plugins allowing to enable/disable each.
|
|
18
|
+
*/
|
|
19
|
+
export declare class Plugins extends Panel {
|
|
20
|
+
constructor(options: Plugins.IOptions);
|
|
21
|
+
readonly model: PluginListModel;
|
|
22
|
+
protected trans: TranslationBundle;
|
|
23
|
+
}
|