Merge pull request #87 from jtpio/todos

Handle disabled extensions, fix a couple of TODO items
pull/6294/head
Jeremy Tuloup 5 years ago committed by GitHub
commit edfdca8a21
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -68,6 +68,7 @@ async function main() {
const App = require('@jupyterlab-classic/application').App;
const app = new App();
const disabled = [];
// TODO: formalize the way the set of initial extensions and plugins are specified
let mods = [
// @jupyterlab-classic plugins
@ -150,6 +151,32 @@ async function main() {
]);
}
/**
* Iterate over active plugins in an extension.
*
* #### Notes
* This also populates the disabled
*/
function* activePlugins(extension) {
// Handle commonjs or es2015 modules
let exports;
if (Object.prototype.hasOwnProperty.call(extension, '__esModule')) {
exports = extension.default;
} else {
// CommonJS exports.
exports = extension;
}
let plugins = Array.isArray(exports) ? exports : [exports];
for (let plugin of plugins) {
if (PageConfig.Extension.isDisabled(plugin.id)) {
disabled.push(plugin.id);
continue;
}
yield plugin;
}
}
const extension_data = JSON.parse(
PageConfig.getOption('federated_extensions')
);
@ -200,7 +227,9 @@ async function main() {
);
federatedExtensions.forEach(p => {
if (p.status === 'fulfilled') {
mods.push(p.value);
for (let plugin of activePlugins(p.value)) {
mods.push(plugin);
}
} else {
console.error(p.reason);
}

@ -9,11 +9,6 @@
flex-shrink: 1;
}
/* TODO: move to edit-extension */
.jp-Document {
height: 100%;
}
.jp-MainAreaWidget {
height: 100%;
}

@ -0,0 +1,3 @@
.jp-Document {
height: 100%;
}

@ -44,6 +44,7 @@
"@jupyterlab/apputils": "^3.0.0",
"@jupyterlab/docmanager": "^3.0.0",
"@jupyterlab/notebook": "^3.0.0",
"@lumino/polling": "^1.3.3",
"@lumino/widgets": "^1.14.0"
},
"devDependencies": {

@ -20,6 +20,8 @@ import {
IClassicShell
} from '@jupyterlab-classic/application';
import { Poll } from '@lumino/polling';
import { Widget } from '@lumino/widgets';
/**
@ -84,9 +86,16 @@ const checkpoints: JupyterFrontEndPlugin<void> = {
if (classicShell) {
classicShell.currentChanged.connect(onChange);
}
// TODO: replace by a Poll
onChange();
setInterval(onChange, 2000);
new Poll({
auto: true,
factory: () => onChange(),
frequency: {
interval: 2000,
backoff: false
},
standby: 'when-hidden'
});
}
};

@ -19,8 +19,7 @@
}
.jp-ClassicKernelStatus {
/* TODO: replace with lab variable */
font-size: 12px;
font-size: var(--jp-ui-font-size1);
margin: 0;
font-weight: normal;
color: var(--jp-ui-font-color0);

Loading…
Cancel
Save