Skip to content

Commit

Permalink
Fix translator usage, remove @jupyterlab/rendermime-interfaces depend…
Browse files Browse the repository at this point in the history
  • Loading branch information
andrii-i committed Feb 13, 2024
1 parent 23eeb92 commit 33b51be
Show file tree
Hide file tree
Showing 4 changed files with 2,397 additions and 4,141 deletions.
6 changes: 5 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,6 @@
"@jupyterlab/docmanager-extension": "^3.4.2",
"@jupyterlab/filebrowser": "^3.4.1",
"@jupyterlab/launcher": "^3.4.4",
"@jupyterlab/rendermime-interfaces": "^3.0.0",
"@jupyterlab/services": "^6.4.2",
"@jupyterlab/translation": "^3.4.1",
"@jupyterlab/ui-components": "^3.4.2",
Expand Down Expand Up @@ -105,6 +104,11 @@
"typescript": "~4.1.3"
},
"resolutions": {
"@jupyterlab/nbformat": "^3.0.0",
"@lumino/coreutils": "^1.11.0",
"@lumino/disposable": "^1.10.0",
"@lumino/signaling": "^1.10.0",
"@jupyterlab/rendermime-interfaces": "3.6.7",
"@types/react": "^17.0.1",
"@types/react-dom": "^18.0.5"
},
Expand Down
8 changes: 4 additions & 4 deletions src/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ import {
import { FileBrowser, IFileBrowserFactory } from '@jupyterlab/filebrowser';
import { ILauncher } from '@jupyterlab/launcher';
import { INotebookTracker } from '@jupyterlab/notebook';
import { IRenderMime } from '@jupyterlab/rendermime-interfaces';
import { Contents, ServerConnection } from '@jupyterlab/services';
import { ITranslator } from '@jupyterlab/translation';

Expand Down Expand Up @@ -52,8 +51,9 @@ type EventLog = {
*/
async function verifyServerExtension(props: {
api: SchedulerService;
trans: IRenderMime.TranslationBundle;
translator: ITranslator;
}) {
const trans = props.translator.load('jupyterlab');
try {
await props.api.getJobs({ max_items: 0 });
} catch (e: unknown) {
Expand All @@ -63,7 +63,7 @@ async function verifyServerExtension(props: {
e.response.status === 404
) {
showDialog({
title: props.trans.__('Jupyter Scheduler server extension not found'),
title: trans.__('Jupyter Scheduler server extension not found'),
body: SERVER_EXTENSION_404_JSX,
buttons: [Dialog.okButton()]
}).catch(console.warn);
Expand Down Expand Up @@ -176,7 +176,7 @@ function activatePlugin(
): void {
const trans = translator.load('jupyterlab');
const api = new SchedulerService({});
verifyServerExtension({ api, trans });
verifyServerExtension({ api, translator });

const { commands } = app;
const fileBrowserTracker = browserFactory.tracker;
Expand Down
3 changes: 2 additions & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,12 @@
"noUnusedLocals": true,
"preserveWatchOutput": true,
"resolveJsonModule": true,
"skipLibCheck": true,
"outDir": "lib",
"rootDir": "src",
"strict": true,
"strictNullChecks": true,
"target": "es2018",
"target": "ES2017",
"types": ["jest"]
},
"include": ["src/**/*"]
Expand Down
Loading

0 comments on commit 33b51be

Please sign in to comment.