Skip to content

Commit

Permalink
Run linter
Browse files Browse the repository at this point in the history
  • Loading branch information
martinRenou committed Oct 15, 2024
1 parent d7c28ab commit b072450
Show file tree
Hide file tree
Showing 8 changed files with 85 additions and 58 deletions.
42 changes: 42 additions & 0 deletions packages/voila/src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import {
IFederatedExtensionData,
activePlugins,
createModule,
isIpywidgets7extension,
loadComponent,
shouldUseMathJax2
} from './tools';
Expand Down Expand Up @@ -74,6 +75,47 @@ async function main() {
})
);

console.log('lab extensions!', extensions);

// Extract out @voila-dashboards/widget-manager packages
// we'll include them back later depending on the requested version
const widgetsManager7Extension = extensions.splice(
extensions.findIndex(
(ext) =>
ext.status === 'fulfilled' &&
ext.value.name === '@voila-dashboards/widgets-manager7'
),
1
)[0];
const widgetsManager8Extension = extensions.splice(
extensions.findIndex(
(ext) =>
ext.status === 'fulfilled' &&
ext.value.name === '@voila-dashboards/widgets-manager8'
),
1
)[0];
const officialWidgetsManagerExtension = extensions.splice(
extensions.findIndex(
(ext) =>
ext.status === 'fulfilled' &&
ext.value.name === '@jupyter-widgets/jupyterlab-manager'
),
1
)[0];
if (
officialWidgetsManagerExtension &&
officialWidgetsManagerExtension.status === 'fulfilled'
) {
const ext = officialWidgetsManagerExtension.value;

if (ext.extension) {
const module = await createModule(ext.name, ext.extension);
console.log('loaded jupyter widgets module', module);
}
}
console.log(widgetsManager7Extension, widgetsManager8Extension);

extensions.forEach((p) => {
if (p.status === 'rejected') {
// There was an error loading the component
Expand Down
5 changes: 1 addition & 4 deletions packages/voila/src/plugins/outputs/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,4 @@ import {
renderOutputsProgressivelyPlugin
} from './plugins';

export {
renderOutputsPlugin,
renderOutputsProgressivelyPlugin
};
export { renderOutputsPlugin, renderOutputsProgressivelyPlugin };
58 changes: 25 additions & 33 deletions packages/widgets_manager7/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,8 @@ import { KernelConnection } from '@jupyterlab/services/lib/kernel/default';

import { VoilaWidgetManager } from './manager';


const WIDGET_MIMETYPE = 'application/vnd.jupyter.widget-view+json';


/**
* The Voila widgets manager plugin.
*/
Expand All @@ -48,7 +46,7 @@ const widgetManager: JupyterFrontEndPlugin<IJupyterWidgetRegistry> = {
app: JupyterFrontEnd,
rendermime: IRenderMimeRegistry
): Promise<IJupyterWidgetRegistry> => {
if (app.name !== 'Voila'){
if (app.name !== 'Voila') {
throw Error(
'The Voila Widget Manager plugin must be activated in a VoilaApp'
);
Expand All @@ -69,32 +67,36 @@ const widgetManager: JupyterFrontEndPlugin<IJupyterWidgetRegistry> = {

const context = {
sessionContext: {
session: {
kernel,
kernelChanged: {
connect: () => {}
},
},
statusChanged: {
connect: () => {}
},
session: {
kernel,
kernelChanged: {
connect: () => {}
},
connectionStatusChanged: {
connect: () => {}
},
},
saveState: {
connect: () => {}
}
},
statusChanged: {
connect: () => {}
},
kernelChanged: {
connect: () => {}
},
connectionStatusChanged: {
connect: () => {}
}
},
saveState: {
connect: () => {}
}
};

const settings = {
saveState: false
};

const manager = new VoilaWidgetManager(context as any, rendermime, settings);
const manager = new VoilaWidgetManager(
context as any,
rendermime,
settings
);
(app as any).widgetManager = manager;

rendermime.removeMimeType(WIDGET_MIMETYPE);
Expand Down Expand Up @@ -136,10 +138,7 @@ const baseWidgets7Plugin: JupyterFrontEndPlugin<void> = {
id: `@jupyter-widgets/jupyterlab-manager:base-${JUPYTER_WIDGETS_VERSION}`,
requires: [IJupyterWidgetRegistry],
autoStart: true,
activate: (
app: JupyterFrontEnd,
registry: IJupyterWidgetRegistry
): void => {
activate: (app: JupyterFrontEnd, registry: IJupyterWidgetRegistry): void => {
registry.registerWidget({
name: '@jupyter-widgets/base',
version: JUPYTER_WIDGETS_VERSION,
Expand All @@ -164,10 +163,7 @@ const controlWidgets7Plugin: JupyterFrontEndPlugin<void> = {
id: `@jupyter-widgets/jupyterlab-manager:controls-${JUPYTER_CONTROLS_VERSION}`,
requires: [IJupyterWidgetRegistry],
autoStart: true,
activate: (
app: JupyterFrontEnd,
registry: IJupyterWidgetRegistry
): void => {
activate: (app: JupyterFrontEnd, registry: IJupyterWidgetRegistry): void => {
registry.registerWidget({
name: '@jupyter-widgets/controls',
version: JUPYTER_CONTROLS_VERSION,
Expand All @@ -190,8 +186,4 @@ const controlWidgets7Plugin: JupyterFrontEndPlugin<void> = {
}
};

export default [
widgetManager,
baseWidgets7Plugin,
controlWidgets7Plugin
];
export default [widgetManager, baseWidgets7Plugin, controlWidgets7Plugin];
1 change: 0 additions & 1 deletion packages/widgets_manager7/src/manager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import { WidgetModel } from '@jupyter-widgets/base';
import { WidgetManager } from '@jupyter-widgets/jupyterlab-manager';
import { ISignal, Signal } from '@lumino/signaling';


export class VoilaWidgetManager extends WidgetManager {
register_model(model_id: string, modelPromise: Promise<WidgetModel>): void {
super.register_model(model_id, modelPromise);
Expand Down
16 changes: 8 additions & 8 deletions packages/widgets_manager7/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
{
"extends": "../../tsconfigbase",
"compilerOptions": {
"outDir": "lib",
"rootDir": "src",
"types": ["node"]
},
"include": ["src/**/*"]
}
"extends": "../../tsconfigbase",
"compilerOptions": {
"outDir": "lib",
"rootDir": "src",
"types": ["node"]
},
"include": ["src/**/*"]
}
6 changes: 2 additions & 4 deletions packages/widgets_manager8/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ const widgetManager: JupyterFrontEndPlugin<IJupyterWidgetRegistry> = {
app: JupyterFrontEnd,
rendermime: IRenderMimeRegistry
): Promise<IJupyterWidgetRegistry> => {
if (app.name !== 'Voila'){
if (app.name !== 'Voila') {
throw Error(
'The Voila Widget Manager plugin must be activated in a VoilaApp'
);
Expand Down Expand Up @@ -89,6 +89,4 @@ const widgetManager: JupyterFrontEndPlugin<IJupyterWidgetRegistry> = {
}
};

export default [
widgetManager
];
export default [widgetManager];
1 change: 0 additions & 1 deletion packages/widgets_manager8/src/manager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import { WidgetModel } from '@jupyter-widgets/base';
import { KernelWidgetManager } from '@jupyter-widgets/jupyterlab-manager';
import { ISignal, Signal } from '@lumino/signaling';


export class VoilaWidgetManager extends KernelWidgetManager {
register_model(model_id: string, modelPromise: Promise<WidgetModel>): void {
super.register_model(model_id, modelPromise);
Expand Down
14 changes: 7 additions & 7 deletions packages/widgets_manager8/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{
"extends": "../../tsconfigbase",
"compilerOptions": {
"outDir": "lib",
"rootDir": "src"
},
"include": ["src/**/*"]
}
"extends": "../../tsconfigbase",
"compilerOptions": {
"outDir": "lib",
"rootDir": "src"
},
"include": ["src/**/*"]
}

0 comments on commit b072450

Please sign in to comment.