1
- import { PageConfig } from '@jupyterlab/coreutils' ;
2
1
/***************************************************************************
3
2
* Copyright (c) 2022, Voilà contributors *
4
3
* Copyright (c) 2022, QuantStack *
@@ -13,64 +12,15 @@ import {
13
12
JupyterFrontEndPlugin
14
13
} from '@jupyterlab/application' ;
15
14
import { IThemeManager } from '@jupyterlab/apputils' ;
16
- import { ITranslator , TranslationManager } from '@jupyterlab/translation' ;
17
15
import { PromiseDelegate } from '@lumino/coreutils' ;
18
- import { VoilaApp } from '@voila-dashboards/voila' ;
19
-
16
+ import { translatorPlugin , pathsPlugin } from '@voila-dashboards/voila' ;
17
+ import { PageConfig } from '@jupyterlab/coreutils' ;
20
18
import { VoiliteWidgetManager } from './manager' ;
21
19
22
- /**
23
- * The default paths.
24
- */
25
- const paths : JupyterFrontEndPlugin < JupyterFrontEnd . IPaths > = {
26
- id : '@voila-dashboards/voila:paths' ,
27
- activate : (
28
- app : JupyterFrontEnd < JupyterFrontEnd . IShell >
29
- ) : JupyterFrontEnd . IPaths => {
30
- return ( app as VoilaApp ) . paths ;
31
- } ,
32
- autoStart : true ,
33
- provides : JupyterFrontEnd . IPaths
34
- } ;
35
-
36
- /**
37
- * A plugin to stop polling the kernels, sessions and kernel specs.
38
- *
39
- * TODO: a cleaner solution would involve a custom ServiceManager to the VoilaApp
40
- * to prevent the default behavior of polling the /api endpoints.
41
- */
42
- const stopPolling : JupyterFrontEndPlugin < void > = {
43
- id : '@voila-dashboards/voila:stop-polling' ,
44
- autoStart : true ,
45
- activate : ( app : JupyterFrontEnd ) : void => {
46
- app . serviceManager . sessions ?. ready . then ( value => {
47
- app . serviceManager . sessions [ '_kernelManager' ] [ '_pollModels' ] ?. stop ( ) ;
48
- void app . serviceManager . sessions [ '_pollModels' ] . stop ( ) ;
49
- } ) ;
50
-
51
- app . serviceManager . kernelspecs ?. ready . then ( value => {
52
- void app . serviceManager . kernelspecs . dispose ( ) ;
53
- } ) ;
54
- }
55
- } ;
56
-
57
- /**
58
- * A simplified Translator
59
- */
60
- const translator : JupyterFrontEndPlugin < ITranslator > = {
61
- id : '@voila-dashboards/voila:translator' ,
62
- activate : ( app : JupyterFrontEnd < JupyterFrontEnd . IShell > ) : ITranslator => {
63
- const translationManager = new TranslationManager ( ) ;
64
- return translationManager ;
65
- } ,
66
- autoStart : true ,
67
- provides : ITranslator
68
- } ;
69
-
70
20
export const managerPromise = new PromiseDelegate < VoiliteWidgetManager > ( ) ;
71
21
72
22
/**
73
- * The Voila widgets manager plugin.
23
+ * The Voilite widgets manager plugin.
74
24
*/
75
25
const widgetManager = {
76
26
id : '@voila-dashboards/voilite:widget-manager' ,
@@ -113,9 +63,8 @@ const themePlugin: JupyterFrontEndPlugin<void> = {
113
63
* Export the plugins as default.
114
64
*/
115
65
const plugins : JupyterFrontEndPlugin < any > [ ] = [
116
- paths ,
117
- stopPolling ,
118
- translator ,
66
+ pathsPlugin ,
67
+ translatorPlugin ,
119
68
widgetManager ,
120
69
themePlugin
121
70
] ;
0 commit comments