Skip to content

Commit 79bc27a

Browse files
committed
fix(jupyter): replace manual index.html patching with config-based plugin (#114)
The postMessage signal AnalySim relies on to detect when JupyterLite is ready was injected by patching a manually copied index.html file. Every jupyter lite build regenerates that file, silently wiping the patch out. This is why upgrading JupyterLite has historically required manual work. Changes in this commit: - analysim_notifier plugin: the postMessage logic now lives in a proper JupyterLite plugin using app.started, which is the stable API for this. The plugin survives version upgrades without any manual steps. - jupyter_lite_config.json: explicit build config so output directory is always dist/ and no manual steps are needed after building. - jupyter-lite.json: runtime config for app name and extension settings, previously absent entirely. - overrides.json: UI defaults (theme) in one declarative place. - Consolidated JupyterLiteStorageService: the service existed in two near-identical copies in admin and project folders. Moved to app/shared/services/ with old files re-exporting for compatibility. - Fixed event listener leak in ProjectNotebookItemDisplayComponent: the window message listener added in ngOnInit was never removed in ngOnDestroy, causing listeners to accumulate on repeated opens. Fixes #114
1 parent e5e49b3 commit 79bc27a

File tree

9 files changed

+274
-354
lines changed

9 files changed

+274
-354
lines changed
Original file line numberDiff line numberDiff line change
@@ -1,49 +1,3 @@
1-
import { Injectable } from '@angular/core';
2-
import * as localforage from 'localforage';
3-
4-
@Injectable({
5-
providedIn: 'root',
6-
})
7-
export class JupyterLiteStorageService {
8-
private filesStore: LocalForage;
9-
private checkpointsStore: LocalForage;
10-
11-
constructor() {
12-
this.filesStore = localforage.createInstance({
13-
name: 'JupyterLite Storage',
14-
storeName: 'files', // Object store name
15-
description: 'Storage for JupyterLite files',
16-
});
17-
this.checkpointsStore = localforage.createInstance({
18-
name: 'JupyterLite Storage',
19-
storeName: 'checkpoints', // Object store name
20-
description: 'Storage for JupyterLite checkpoints',
21-
});
22-
}
23-
24-
// Add a file to the IndexedDB
25-
addFile(fileName: string, fileData: any): Promise<any> {
26-
return this.filesStore.setItem(fileName, fileData);
27-
}
28-
29-
// Get a file by its name
30-
getFile(fileName: string): Promise<any> {
31-
return this.filesStore.getItem(fileName);
32-
}
33-
34-
getCheckpoints(fileName: string): Promise<any> {
35-
return this.checkpointsStore.getItem(fileName);
36-
}
37-
38-
removeFile(fileName: string): Promise<any> {
39-
return this.filesStore.removeItem(fileName);
40-
}
41-
42-
// Get all files
43-
getAllFiles(): Promise<any[]> {
44-
const files: any[] = [];
45-
return this.filesStore.iterate((value, key) => {
46-
files.push({ key, value });
47-
}).then(() => files);
48-
}
49-
}
1+
// JupyterLiteStorageService has been consolidated into a shared service.
2+
// This file re-exports from the new location for backwards compatibility.
3+
export { JupyterLiteStorageService } from '../../../../../shared/services/jupyter-lite-storage.service';

0 commit comments

Comments
 (0)