Skip to content

Commit

Permalink
Embed jupyterlab-widgets plugins
Browse files Browse the repository at this point in the history
  • Loading branch information
trungleduc committed Sep 15, 2023
1 parent f625a4d commit 2c01e79
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 18 deletions.
12 changes: 5 additions & 7 deletions packages/voila/src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,6 @@ import {

//Inspired by: https://github.com/jupyterlab/jupyterlab/blob/master/dev_mode/index.js

const disabled = [
'@jupyter-widgets/jupyterlab-manager:plugin',
'@jupyter-widgets/jupyterlab-manager:saveWidgetState'
];

/**
* The main function
*/
Expand All @@ -44,6 +39,9 @@ async function main() {
require('@jupyterlab/rendermime-extension'),
require('@jupyterlab/theme-light-extension'),
require('@jupyterlab/theme-dark-extension'),
require('@jupyter-widgets/jupyterlab-manager/lib/plugin').default.filter(
(p: any) => p.id !== '@jupyter-widgets/jupyterlab-manager:plugin'
),
plugins
];

Expand Down Expand Up @@ -101,7 +99,7 @@ async function main() {
);
federatedExtensions.forEach((p) => {
if (p.status === 'fulfilled') {
for (const plugin of activePlugins(p.value, disabled)) {
for (const plugin of activePlugins(p.value, [])) {
mods.push(plugin);
}
} else {
Expand All @@ -115,7 +113,7 @@ async function main() {
);
federatedMimeExtensions.forEach((p) => {
if (p.status === 'fulfilled') {
for (const plugin of activePlugins(p.value, disabled)) {
for (const plugin of activePlugins(p.value, [])) {
mimeExtensions.push(plugin);
}
} else {
Expand Down
12 changes: 2 additions & 10 deletions packages/voila/src/tree.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,6 @@ import {
widgetManager
} from './voilaplugins';

export const TREE_DISABLED_EXTENSIONS = [
'@jupyter-widgets/jupyterlab-manager:plugin',
'@jupyter-widgets/jupyterlab-manager:saveWidgetState',
'@jupyter-widgets/jupyterlab-manager:base-2.0.0',
'@jupyter-widgets/jupyterlab-manager:controls-2.0.0',
'@jupyter-widgets/jupyterlab-manager:output-1.0.0'
];

/**
* The main function
*/
Expand Down Expand Up @@ -100,7 +92,7 @@ async function main() {
);
federatedExtensions.forEach((p) => {
if (p.status === 'fulfilled') {
for (const plugin of activePlugins(p.value, TREE_DISABLED_EXTENSIONS)) {
for (const plugin of activePlugins(p.value, [])) {
mods.push(plugin);
}
} else {
Expand All @@ -114,7 +106,7 @@ async function main() {
);
federatedMimeExtensions.forEach((p) => {
if (p.status === 'fulfilled') {
for (const plugin of activePlugins(p.value, TREE_DISABLED_EXTENSIONS)) {
for (const plugin of activePlugins(p.value, [])) {
mimeExtensions.push(plugin);
}
} else {
Expand Down
3 changes: 2 additions & 1 deletion voila/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -118,9 +118,10 @@ def get_page_config(base_url, settings, log, voila_configuration: VoilaConfigura
disabled_extensions = [
"@voila-dashboards/jupyterlab-preview",
"@jupyter/collaboration-extension",
"@jupyter-widgets/jupyterlab-manager",
]
disabled_extensions.extend(page_config.get("disabledExtensions", []))
required_extensions = ["@jupyter-widgets/jupyterlab-manager"]
required_extensions = []
federated_extensions = deepcopy(page_config["federated_extensions"])

page_config["federated_extensions"] = filter_extension(
Expand Down

0 comments on commit 2c01e79

Please sign in to comment.