@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/widget.js
ADDED
|
@@ -0,0 +1,184 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) Jupyter Development Team.
|
|
3
|
+
* Distributed under the terms of the Modified BSD License.
|
|
4
|
+
*/
|
|
5
|
+
import { VDomRenderer } from '@jupyterlab/apputils';
|
|
6
|
+
import { FilterBox, lockIcon, Table } from '@jupyterlab/ui-components';
|
|
7
|
+
import { Panel } from '@lumino/widgets';
|
|
8
|
+
import * as React from 'react';
|
|
9
|
+
/**
|
|
10
|
+
* Panel with a table of available plugins allowing to enable/disable each.
|
|
11
|
+
*/
|
|
12
|
+
export class Plugins extends Panel {
|
|
13
|
+
constructor(options) {
|
|
14
|
+
const { model, translator } = options;
|
|
15
|
+
super();
|
|
16
|
+
this.model = model;
|
|
17
|
+
this.addClass('jp-pluginmanager');
|
|
18
|
+
this.trans = translator.load('jupyterlab');
|
|
19
|
+
this.addWidget(new Disclaimer(model, this.trans));
|
|
20
|
+
const header = new Header(model, this.trans);
|
|
21
|
+
this.addWidget(header);
|
|
22
|
+
const availableList = new AvailableList(model, this.trans);
|
|
23
|
+
this.addWidget(availableList);
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
class AvailableList extends VDomRenderer {
|
|
27
|
+
constructor(model, trans) {
|
|
28
|
+
super(model);
|
|
29
|
+
this.trans = trans;
|
|
30
|
+
this.addClass('jp-pluginmanager-AvailableList');
|
|
31
|
+
}
|
|
32
|
+
render() {
|
|
33
|
+
return (React.createElement(React.Fragment, null, this.model.statusError !== null ? (React.createElement(ErrorMessage, null, this.trans.__('Error querying installed extensions%1', this.model.statusError ? `: ${this.model.statusError}` : '.'))) : this.model.isLoading ? (React.createElement("div", { className: "jp-pluginmanager-loader" }, this.trans.__('Updating plugin list…'))) : (React.createElement(Table, { blankIndicator: () => {
|
|
34
|
+
return React.createElement("div", null, this.trans.__('No entries'));
|
|
35
|
+
}, sortKey: 'plugin-id', rows: this.model.available
|
|
36
|
+
.filter(pkg => {
|
|
37
|
+
const pattern = new RegExp(this.model.query, 'i');
|
|
38
|
+
return (pattern.test(pkg.id) ||
|
|
39
|
+
pattern.test(pkg.extension) ||
|
|
40
|
+
(pkg.tokenLabel && pattern.test(pkg.tokenLabel)));
|
|
41
|
+
})
|
|
42
|
+
.map(data => {
|
|
43
|
+
return {
|
|
44
|
+
data: data,
|
|
45
|
+
key: data.id
|
|
46
|
+
};
|
|
47
|
+
}), columns: [
|
|
48
|
+
{
|
|
49
|
+
id: 'plugin-id',
|
|
50
|
+
label: this.trans.__('Plugin'),
|
|
51
|
+
renderCell: (row) => (React.createElement(React.Fragment, null,
|
|
52
|
+
React.createElement("code", null, row.id),
|
|
53
|
+
React.createElement("br", null),
|
|
54
|
+
row.description)),
|
|
55
|
+
sort: (a, b) => a.id.localeCompare(b.id)
|
|
56
|
+
},
|
|
57
|
+
{
|
|
58
|
+
id: 'description',
|
|
59
|
+
label: this.trans.__('Description'),
|
|
60
|
+
renderCell: (row) => React.createElement(React.Fragment, null, row.description),
|
|
61
|
+
sort: (a, b) => a.description && b.description
|
|
62
|
+
? a.description.localeCompare(b.description)
|
|
63
|
+
: undefined,
|
|
64
|
+
isHidden: true
|
|
65
|
+
},
|
|
66
|
+
{
|
|
67
|
+
id: 'autostart',
|
|
68
|
+
label: this.trans.__('Autostart?'),
|
|
69
|
+
renderCell: (row) => {
|
|
70
|
+
switch (row.autoStart) {
|
|
71
|
+
case 'defer':
|
|
72
|
+
return this.trans.__('Defer');
|
|
73
|
+
case true:
|
|
74
|
+
return this.trans.__('Yes');
|
|
75
|
+
case false:
|
|
76
|
+
case undefined: // The default is `false`.
|
|
77
|
+
return this.trans.__('No');
|
|
78
|
+
default:
|
|
79
|
+
const leftover = row.autoStart;
|
|
80
|
+
throw new Error(`Unknown value: ${leftover}`);
|
|
81
|
+
}
|
|
82
|
+
},
|
|
83
|
+
sort: (a, b) => a.autoStart === b.autoStart ? 0 : a.autoStart ? -1 : 1
|
|
84
|
+
},
|
|
85
|
+
{
|
|
86
|
+
id: 'requires',
|
|
87
|
+
label: this.trans.__('Depends on'),
|
|
88
|
+
renderCell: (row) => (React.createElement(React.Fragment, null, row.requires.map(v => v.name).join('\n'))),
|
|
89
|
+
sort: (a, b) => (a.requires || []).length - (b.requires || []).length,
|
|
90
|
+
isHidden: true
|
|
91
|
+
},
|
|
92
|
+
{
|
|
93
|
+
id: 'extension',
|
|
94
|
+
label: this.trans.__('Extension'),
|
|
95
|
+
renderCell: (row) => React.createElement(React.Fragment, null, row.extension),
|
|
96
|
+
sort: (a, b) => a.extension.localeCompare(b.extension)
|
|
97
|
+
},
|
|
98
|
+
{
|
|
99
|
+
id: 'provides',
|
|
100
|
+
label: this.trans.__('Provides'),
|
|
101
|
+
renderCell: (row) => (React.createElement(React.Fragment, null, row.provides ? (React.createElement("code", { title: row.provides.name }, row.tokenLabel)) : ('-'))),
|
|
102
|
+
sort: (a, b) => (a.tokenLabel || '').localeCompare(b.tokenLabel || '')
|
|
103
|
+
},
|
|
104
|
+
{
|
|
105
|
+
id: 'enabled',
|
|
106
|
+
label: this.trans.__('Enabled'),
|
|
107
|
+
renderCell: (row) => (React.createElement(React.Fragment, null,
|
|
108
|
+
React.createElement("input", { type: "checkbox", checked: row.enabled, disabled: row.locked || !this.model.isDisclaimed, title: row.locked || !this.model.isDisclaimed
|
|
109
|
+
? row.locked
|
|
110
|
+
? this.trans.__('This plugin is locked.')
|
|
111
|
+
: this.trans.__('To enable/disable, please acknowledge the disclaimer.')
|
|
112
|
+
: row.enabled
|
|
113
|
+
? this.trans.__('Disable %1 plugin', row.id)
|
|
114
|
+
: this.trans.__('Enable %1 plugin', row.id), onChange: (event) => {
|
|
115
|
+
if (!this.model.isDisclaimed) {
|
|
116
|
+
return;
|
|
117
|
+
}
|
|
118
|
+
if (event.target.checked) {
|
|
119
|
+
void this.onAction('enable', row);
|
|
120
|
+
}
|
|
121
|
+
else {
|
|
122
|
+
void this.onAction('disable', row);
|
|
123
|
+
}
|
|
124
|
+
} }),
|
|
125
|
+
row.locked ? (React.createElement(lockIcon.react, { tag: "span", title: this.trans.__('This plugin was locked by system administrator or is a critical dependency and cannot be enabled/disabled.') })) : (''))),
|
|
126
|
+
sort: (a, b) => +a.enabled - +b.enabled
|
|
127
|
+
}
|
|
128
|
+
] }))));
|
|
129
|
+
}
|
|
130
|
+
/**
|
|
131
|
+
* Callback handler for when the user wants to perform an action on an extension.
|
|
132
|
+
*
|
|
133
|
+
* @param action The action to perform.
|
|
134
|
+
* @param entry The entry to perform the action on.
|
|
135
|
+
*/
|
|
136
|
+
onAction(action, entry) {
|
|
137
|
+
switch (action) {
|
|
138
|
+
case 'enable':
|
|
139
|
+
return this.model.enable(entry);
|
|
140
|
+
case 'disable':
|
|
141
|
+
return this.model.disable(entry);
|
|
142
|
+
default:
|
|
143
|
+
throw new Error(`Invalid action: ${action}`);
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
class Disclaimer extends VDomRenderer {
|
|
148
|
+
constructor(model, trans) {
|
|
149
|
+
super(model);
|
|
150
|
+
this.trans = trans;
|
|
151
|
+
this.addClass('jp-pluginmanager-Disclaimer');
|
|
152
|
+
}
|
|
153
|
+
render() {
|
|
154
|
+
return (React.createElement("div", null,
|
|
155
|
+
React.createElement("div", null, this.trans.__('Customise your experience/improve performance by disabling plugins you do not need. To disable or uninstall an entire extension use the Extension Manager instead. Changes will apply after reloading JupyterLab.')),
|
|
156
|
+
React.createElement("label", null,
|
|
157
|
+
React.createElement("input", { type: "checkbox", className: "jp-mod-styled jp-pluginmanager-Disclaimer-checkbox", defaultChecked: this.model.isDisclaimed, onChange: event => {
|
|
158
|
+
this.model.isDisclaimed = event.target.checked;
|
|
159
|
+
} }),
|
|
160
|
+
this.trans.__('I understand that disabling core application plugins may render features and parts of the user interface unavailable and recovery using `jupyter labextension enable <plugin-name>` command may be required'))));
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
class Header extends VDomRenderer {
|
|
164
|
+
constructor(model, trans) {
|
|
165
|
+
super(model);
|
|
166
|
+
this.trans = trans;
|
|
167
|
+
this.addClass('jp-pluginmanager-Header');
|
|
168
|
+
}
|
|
169
|
+
render() {
|
|
170
|
+
return (React.createElement(React.Fragment, null,
|
|
171
|
+
React.createElement(FilterBox, { placeholder: this.trans.__('Filter'), updateFilter: (fn, query) => {
|
|
172
|
+
this.model.query = query !== null && query !== void 0 ? query : '';
|
|
173
|
+
}, initialQuery: this.model.query, useFuzzyFilter: false }),
|
|
174
|
+
React.createElement("div", { className: `jp-pluginmanager-pending ${this.model.hasPendingActions() ? 'jp-mod-hasPending' : ''}` }),
|
|
175
|
+
this.model.actionError && (React.createElement(ErrorMessage, null,
|
|
176
|
+
React.createElement("p", null, this.trans.__('Error when performing an action.')),
|
|
177
|
+
React.createElement("p", null, this.trans.__('Reason given:')),
|
|
178
|
+
React.createElement("pre", null, this.model.actionError)))));
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
function ErrorMessage(props) {
|
|
182
|
+
return React.createElement("div", { className: "jp-pluginmanager-error" }, props.children);
|
|
183
|
+
}
|
|
184
|
+
//# sourceMappingURL=widget.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"widget.js","sourceRoot":"","sources":["../src/widget.tsx"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AAEpD,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,2BAA2B,CAAC;AACvE,OAAO,EAAE,KAAK,EAAE,MAAM,iBAAiB,CAAC;AACxC,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAgB/B;;GAEG;AACH,MAAM,OAAO,OAAQ,SAAQ,KAAK;IAChC,YAAY,OAAyB;QACnC,MAAM,EAAE,KAAK,EAAE,UAAU,EAAE,GAAG,OAAO,CAAC;QACtC,KAAK,EAAE,CAAC;QACR,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;QACnB,IAAI,CAAC,QAAQ,CAAC,kBAAkB,CAAC,CAAC;QAElC,IAAI,CAAC,KAAK,GAAG,UAAU,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;QAE3C,IAAI,CAAC,SAAS,CAAC,IAAI,UAAU,CAAC,KAAK,EAAE,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC;QAElD,MAAM,MAAM,GAAG,IAAI,MAAM,CAAC,KAAK,EAAE,IAAI,CAAC,KAAK,CAAC,CAAC;QAC7C,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC;QAEvB,MAAM,aAAa,GAAG,IAAI,aAAa,CAAC,KAAK,EAAE,IAAI,CAAC,KAAK,CAAC,CAAC;QAC3D,IAAI,CAAC,SAAS,CAAC,aAAa,CAAC,CAAC;IAChC,CAAC;CAGF;AAED,MAAM,aAAc,SAAQ,YAA6B;IACvD,YACE,KAAsB,EACZ,KAAwB;QAElC,KAAK,CAAC,KAAK,CAAC,CAAC;QAFH,UAAK,GAA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,GACF;YACD,IAAI,CAAC,KAAK,CAAC,WAAW,IAAI,CACzB,oBAAC,YAAY;gBACX,+BAAI,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC,kCAAkC,CAAC,CAAK;gBAC1D,+BAAI,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC,eAAe,CAAC,CAAK;gBACvC,iCAAM,IAAI,CAAC,KAAK,CAAC,WAAW,CAAO,CACtB,CAChB,CACA,CACJ,CAAC;IACJ,CAAC;CACF;AAED,SAAS,YAAY,CAAC,KAA8B;IAClD,OAAO,6BAAK,SAAS,EAAC,wBAAwB,IAAE,KAAK,CAAC,QAAQ,CAAO,CAAC;AACxE,CAAC"}
|
package/package.json
ADDED
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@jupyterlab/pluginmanager",
|
|
3
|
+
"version": "4.1.0-alpha.2",
|
|
4
|
+
"description": "List, enable or disable individual plugins.",
|
|
5
|
+
"homepage": "https://github.com/jupyterlab/jupyterlab",
|
|
6
|
+
"bugs": {
|
|
7
|
+
"url": "https://github.com/jupyterlab/jupyterlab/issues"
|
|
8
|
+
},
|
|
9
|
+
"repository": {
|
|
10
|
+
"type": "git",
|
|
11
|
+
"url": "https://github.com/jupyterlab/jupyterlab.git"
|
|
12
|
+
},
|
|
13
|
+
"license": "BSD-3-Clause",
|
|
14
|
+
"author": "Project Jupyter",
|
|
15
|
+
"sideEffects": [
|
|
16
|
+
"style/**/*"
|
|
17
|
+
],
|
|
18
|
+
"main": "lib/index.js",
|
|
19
|
+
"types": "lib/index.d.ts",
|
|
20
|
+
"style": "style/index.css",
|
|
21
|
+
"directories": {
|
|
22
|
+
"lib": "lib/"
|
|
23
|
+
},
|
|
24
|
+
"files": [
|
|
25
|
+
"lib/**/*.{d.ts,eot,gif,html,jpg,js,js.map,json,png,svg,woff2,ttf}",
|
|
26
|
+
"schema/*.json",
|
|
27
|
+
"style/**/*.{css,eot,gif,html,jpg,json,png,svg,woff2,ttf}",
|
|
28
|
+
"src/**/*.{ts,tsx}",
|
|
29
|
+
"style/index.js"
|
|
30
|
+
],
|
|
31
|
+
"scripts": {
|
|
32
|
+
"build": "tsc -b",
|
|
33
|
+
"build:test": "tsc --build tsconfig.test.json",
|
|
34
|
+
"clean": "rimraf lib tsconfig.tsbuildinfo",
|
|
35
|
+
"test": "jest",
|
|
36
|
+
"test:cov": "jest --collect-coverage",
|
|
37
|
+
"test:debug": "node --inspect-brk ../../node_modules/.bin/jest --runInBand",
|
|
38
|
+
"test:debug:watch": "node --inspect-brk ../../node_modules/.bin/jest --runInBand --watch",
|
|
39
|
+
"watch": "tsc -b --watch"
|
|
40
|
+
},
|
|
41
|
+
"dependencies": {
|
|
42
|
+
"@jupyterlab/application": "^4.1.0-alpha.2",
|
|
43
|
+
"@jupyterlab/apputils": "^4.2.0-alpha.2",
|
|
44
|
+
"@jupyterlab/coreutils": "^6.1.0-alpha.2",
|
|
45
|
+
"@jupyterlab/services": "^7.1.0-alpha.2",
|
|
46
|
+
"@jupyterlab/translation": "^4.1.0-alpha.2",
|
|
47
|
+
"@jupyterlab/ui-components": "^4.1.0-alpha.2",
|
|
48
|
+
"@lumino/coreutils": "^2.1.2",
|
|
49
|
+
"@lumino/signaling": "^2.1.2",
|
|
50
|
+
"@lumino/widgets": "^2.3.1-alpha.0",
|
|
51
|
+
"react": "^18.2.0"
|
|
52
|
+
},
|
|
53
|
+
"devDependencies": {
|
|
54
|
+
"@jupyterlab/testing": "^4.1.0-alpha.2",
|
|
55
|
+
"@types/jest": "^29.2.0",
|
|
56
|
+
"jest": "^29.2.0",
|
|
57
|
+
"rimraf": "~3.0.0",
|
|
58
|
+
"typescript": "~5.0.4"
|
|
59
|
+
},
|
|
60
|
+
"publishConfig": {
|
|
61
|
+
"access": "public"
|
|
62
|
+
},
|
|
63
|
+
"styleModule": "style/index.js"
|
|
64
|
+
}
|
package/src/dialogs.tsx
ADDED
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
// Copyright (c) Jupyter Development Team.
|
|
2
|
+
// Distributed under the terms of the Modified BSD License.
|
|
3
|
+
import type { JupyterLab } from '@jupyterlab/application';
|
|
4
|
+
import { TranslationBundle } from '@jupyterlab/translation';
|
|
5
|
+
import * as React from 'react';
|
|
6
|
+
|
|
7
|
+
export function PluginRequiredMessage(props: {
|
|
8
|
+
plugin: JupyterLab.IPluginInfo;
|
|
9
|
+
dependants: JupyterLab.IPluginInfo[];
|
|
10
|
+
trans: TranslationBundle;
|
|
11
|
+
}): React.ReactElement<any> {
|
|
12
|
+
return (
|
|
13
|
+
<>
|
|
14
|
+
{props.trans.__(
|
|
15
|
+
'The plugin "%1" cannot be disabled as it is required by other plugins:',
|
|
16
|
+
props.plugin.id
|
|
17
|
+
)}
|
|
18
|
+
<ul>
|
|
19
|
+
{props.dependants.map(plugin => (
|
|
20
|
+
<li key={'dependantsDialog-' + plugin.id}>{plugin.id}</li>
|
|
21
|
+
))}
|
|
22
|
+
</ul>
|
|
23
|
+
{props.trans.__('Please disable the dependant plugins first.')}
|
|
24
|
+
</>
|
|
25
|
+
);
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export function PluginInUseMessage(props: {
|
|
29
|
+
plugin: JupyterLab.IPluginInfo;
|
|
30
|
+
optionalDependants: JupyterLab.IPluginInfo[];
|
|
31
|
+
trans: TranslationBundle;
|
|
32
|
+
}): React.ReactElement<any> {
|
|
33
|
+
return (
|
|
34
|
+
<div className={'jp-pluginmanager-PluginInUseMessage'}>
|
|
35
|
+
{props.trans.__(
|
|
36
|
+
'While the plugin "%1" is not required by other enabled plugins, some plugins provide optional features depending on it. These plugins are:',
|
|
37
|
+
props.plugin.id
|
|
38
|
+
)}
|
|
39
|
+
<ul>
|
|
40
|
+
{props.optionalDependants.map(plugin => (
|
|
41
|
+
<li key={'optionalDependantsDialog-' + plugin.id}>{plugin.id}</li>
|
|
42
|
+
))}
|
|
43
|
+
</ul>
|
|
44
|
+
{props.trans.__('Do you want to disable it anyway?')}
|
|
45
|
+
</div>
|
|
46
|
+
);
|
|
47
|
+
}
|
package/src/index.ts
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
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';
|