Skip to content
This repository has been archived by the owner on Feb 16, 2023. It is now read-only.

Support disabling core retrolab extensions #242

Merged
merged 2 commits into from
Oct 8, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 15 additions & 6 deletions app/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ async function main() {

const disabled = [];
// TODO: formalize the way the set of initial extensions and plugins are specified
let mods = [
let baseMods = [
// @retrolab plugins
require('@retrolab/application-extension'),
require('@retrolab/console-extension'),
Expand Down Expand Up @@ -151,7 +151,7 @@ async function main() {
const page = PageConfig.getOption('retroPage');
switch (page) {
case 'tree': {
mods = mods.concat([
baseMods = baseMods.concat([
require('@jupyterlab/filebrowser-extension').default.filter(({ id }) =>
[
'@jupyterlab/filebrowser-extension:browser',
Expand All @@ -168,7 +168,7 @@ async function main() {
break;
}
case 'notebooks': {
mods = mods.concat([
baseMods = baseMods.concat([
require('@jupyterlab/completer-extension').default.filter(({ id }) =>
['@jupyterlab/completer-extension:notebooks'].includes(id)
),
Expand All @@ -182,7 +182,7 @@ async function main() {
break;
}
case 'consoles': {
mods = mods.concat([
baseMods = baseMods.concat([
require('@jupyterlab/completer-extension').default.filter(({ id }) =>
['@jupyterlab/completer-extension:consoles'].includes(id)
),
Expand All @@ -196,7 +196,7 @@ async function main() {
break;
}
case 'edit': {
mods = mods.concat([
baseMods = baseMods.concat([
require('@jupyterlab/completer-extension').default.filter(({ id }) =>
['@jupyterlab/completer-extension:files'].includes(id)
),
Expand Down Expand Up @@ -241,6 +241,7 @@ async function main() {
PageConfig.getOption('federated_extensions')
);

const mods = [];
const federatedExtensionPromises = [];
const federatedMimeExtensionPromises = [];
const federatedStylePromises = [];
Expand Down Expand Up @@ -280,6 +281,14 @@ async function main() {
}
});

// Add the base frontend extensions
const baseFrontendMods = await Promise.all(baseMods);
baseFrontendMods.forEach(p => {
for (let plugin of activePlugins(p)) {
mods.push(plugin);
}
});

// Add the federated extensions.
// TODO: Add support for disabled extensions
const federatedExtensions = await Promise.allSettled(
Expand All @@ -288,7 +297,7 @@ async function main() {
federatedExtensions.forEach(p => {
if (p.status === 'fulfilled') {
for (let plugin of activePlugins(p.value)) {
mods.push(plugin);
baseMods.push(plugin);
}
} else {
console.error(p.reason);
Expand Down