|
1 |
| -// Removed Widget import as we're no longer using @lumino/widgets |
2 | 1 | import { JupyterLiteServer, JupyterLiteServerPlugin } from '@jupyterlite/server';
|
3 | 2 | import { IKernel, IKernelSpecs } from '@jupyterlite/kernel';
|
4 |
| -import { INotebookTracker} from '@jupyterlab/notebook'; |
| 3 | +import { INotebookTracker } from '@jupyterlab/notebook'; |
5 | 4 | import { EmbeddedKernel } from './kernel';
|
6 | 5 | import WelcomePanel from './panel';
|
7 | 6 | import { ServiceContainer } from './services/ServiceContainer';
|
8 | 7 | import { DeviceService } from './services/DeviceService';
|
9 | 8 |
|
10 |
| -// Variable for saving the DeviceService instance so we can restore it if kernel is restarted |
11 | 9 | var devService: DeviceService | null = null;
|
12 | 10 |
|
13 |
| -// Kernel plugin for the embedded kernel |
14 | 11 | const kernelPlugin: JupyterLiteServerPlugin<void> = {
|
15 | 12 | id: 'jupyterlite-embedded-kernel:kernel',
|
16 | 13 | autoStart: true,
|
17 |
| - requires: [IKernelSpecs], |
18 |
| - activate: (app: JupyterLiteServer, kernelspecs: IKernelSpecs) => { |
| 14 | + requires: [IKernelSpecs, INotebookTracker], // Add INotebookTracker here |
| 15 | + activate: ( |
| 16 | + app: JupyterLiteServer, |
| 17 | + kernelspecs: IKernelSpecs, |
| 18 | + notebookTracker: INotebookTracker // Add notebookTracker parameter |
| 19 | + ) => { |
19 | 20 | const activeKernels = new Map<string, EmbeddedKernel>();
|
20 | 21 |
|
21 | 22 | app.router.post('/api/kernels/(.*)/interrupt', async (req, kernelId: string) => {
|
@@ -49,20 +50,17 @@ const kernelPlugin: JupyterLiteServerPlugin<void> = {
|
49 | 50 | const serviceContainer = new ServiceContainer(devService);
|
50 | 51 | await serviceContainer.init();
|
51 | 52 |
|
52 |
| - // Save the DeviceService instance so we can restore it if kernel is restarted |
53 | 53 | devService = serviceContainer.deviceService;
|
54 | 54 |
|
55 | 55 | const welcomePanel = new WelcomePanel(
|
56 | 56 | serviceContainer,
|
57 |
| - notebookTracker |
| 57 | + notebookTracker // Pass notebookTracker here |
58 | 58 | );
|
59 | 59 | document.body.appendChild(welcomePanel.getElement());
|
60 | 60 | const kernel = new EmbeddedKernel(options, serviceContainer);
|
61 | 61 |
|
62 |
| - // welcomePanel.show(); |
63 | 62 | welcomePanel.initialShow();
|
64 | 63 |
|
65 |
| - // If the deivce is already connected, update the welcome panel |
66 | 64 | if (serviceContainer.deviceService.isConnected()) {
|
67 | 65 | welcomePanel.updateOnConnection("Connected");
|
68 | 66 | }
|
|
0 commit comments