From 7c01cdb77edb9a2d383fa2271cd2054ae691e81c Mon Sep 17 00:00:00 2001 From: "jayesh.singh@fplabs.tech" Date: Tue, 17 Oct 2023 12:39:55 +0530 Subject: [PATCH 1/4] Updated fav-icon Base URL from JupyterLab PageConfig. --- packages/notebook-extension/src/index.ts | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/packages/notebook-extension/src/index.ts b/packages/notebook-extension/src/index.ts index e4d217c577..98a4bd4031 100644 --- a/packages/notebook-extension/src/index.ts +++ b/packages/notebook-extension/src/index.ts @@ -38,6 +38,9 @@ import { Widget } from '@lumino/widgets'; import { TrustedComponent } from './trusted'; +import { PageConfig } from '@jupyterlab/coreutils'; + + /** * The class for kernel status errors. */ @@ -411,6 +414,7 @@ const tabIcon: JupyterFrontEndPlugin = { requires: [INotebookTracker], activate: (app: JupyterFrontEnd, tracker: INotebookTracker) => { // the favicons are provided by Jupyter Server + const baseURL = PageConfig.getBaseUrl(); const notebookIcon = ' /static/favicons/favicon-notebook.ico'; const busyIcon = ' /static/favicons/favicon-busy-1.ico'; @@ -422,10 +426,10 @@ const tabIcon: JupyterFrontEndPlugin = { ) as HTMLLinkElement; switch (status) { case 'busy': - link.href = busyIcon; + link.href = baseURL + busyIcon; break; case 'idle': - link.href = notebookIcon; + link.href = baseURL + notebookIcon; break; } }; From 01224f5b942cb010881acc3c1bf7e54dbd53f578 Mon Sep 17 00:00:00 2001 From: "jayesh.singh@fplabs.tech" Date: Tue, 17 Oct 2023 13:16:07 +0530 Subject: [PATCH 2/4] Reformatted code for reability. --- packages/notebook-extension/src/index.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/packages/notebook-extension/src/index.ts b/packages/notebook-extension/src/index.ts index 98a4bd4031..a885904542 100644 --- a/packages/notebook-extension/src/index.ts +++ b/packages/notebook-extension/src/index.ts @@ -415,8 +415,8 @@ const tabIcon: JupyterFrontEndPlugin = { activate: (app: JupyterFrontEnd, tracker: INotebookTracker) => { // the favicons are provided by Jupyter Server const baseURL = PageConfig.getBaseUrl(); - const notebookIcon = ' /static/favicons/favicon-notebook.ico'; - const busyIcon = ' /static/favicons/favicon-busy-1.ico'; + const notebookIcon = `${baseURL}/static/favicons/favicon-notebook.ico`; + const busyIcon = `${baseURL}/static/favicons/favicon-busy-1.ico`; const updateBrowserFavicon = ( status: ISessionContext.KernelDisplayStatus @@ -426,10 +426,10 @@ const tabIcon: JupyterFrontEndPlugin = { ) as HTMLLinkElement; switch (status) { case 'busy': - link.href = baseURL + busyIcon; + link.href = busyIcon; break; case 'idle': - link.href = baseURL + notebookIcon; + link.href = notebookIcon; break; } }; From 8a5da18bdab61a39bc0e5cf6b52a1333efec91eb Mon Sep 17 00:00:00 2001 From: "jayesh.singh@fplabs.tech" Date: Tue, 17 Oct 2023 13:30:50 +0530 Subject: [PATCH 3/4] Used for conncatinating fac-icon URL --- packages/notebook-extension/src/index.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/notebook-extension/src/index.ts b/packages/notebook-extension/src/index.ts index a885904542..928fbc4c41 100644 --- a/packages/notebook-extension/src/index.ts +++ b/packages/notebook-extension/src/index.ts @@ -38,7 +38,7 @@ import { Widget } from '@lumino/widgets'; import { TrustedComponent } from './trusted'; -import { PageConfig } from '@jupyterlab/coreutils'; +import { PageConfig, URLExt } from '@jupyterlab/coreutils'; /** @@ -415,8 +415,8 @@ const tabIcon: JupyterFrontEndPlugin = { activate: (app: JupyterFrontEnd, tracker: INotebookTracker) => { // the favicons are provided by Jupyter Server const baseURL = PageConfig.getBaseUrl(); - const notebookIcon = `${baseURL}/static/favicons/favicon-notebook.ico`; - const busyIcon = `${baseURL}/static/favicons/favicon-busy-1.ico`; + const notebookIcon = URLExt.join(baseURL, 'static/favicons/favicon-notebook.ico'); + const busyIcon = URLExt.join(baseURL, 'static/favicons/favicon-busy-1.ico'); const updateBrowserFavicon = ( status: ISessionContext.KernelDisplayStatus From cb85ff9863c63c439b214fd801f580be436e6af8 Mon Sep 17 00:00:00 2001 From: Jeremy Tuloup Date: Tue, 17 Oct 2023 14:04:26 +0200 Subject: [PATCH 4/4] Lint --- packages/notebook-extension/src/index.ts | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/packages/notebook-extension/src/index.ts b/packages/notebook-extension/src/index.ts index 928fbc4c41..90c86dcd77 100644 --- a/packages/notebook-extension/src/index.ts +++ b/packages/notebook-extension/src/index.ts @@ -14,7 +14,7 @@ import { import { Cell, CodeCell } from '@jupyterlab/cells'; -import { Text, Time } from '@jupyterlab/coreutils'; +import { PageConfig, Text, Time, URLExt } from '@jupyterlab/coreutils'; import { IDocumentManager } from '@jupyterlab/docmanager'; @@ -38,9 +38,6 @@ import { Widget } from '@lumino/widgets'; import { TrustedComponent } from './trusted'; -import { PageConfig, URLExt } from '@jupyterlab/coreutils'; - - /** * The class for kernel status errors. */ @@ -415,7 +412,10 @@ const tabIcon: JupyterFrontEndPlugin = { activate: (app: JupyterFrontEnd, tracker: INotebookTracker) => { // the favicons are provided by Jupyter Server const baseURL = PageConfig.getBaseUrl(); - const notebookIcon = URLExt.join(baseURL, 'static/favicons/favicon-notebook.ico'); + const notebookIcon = URLExt.join( + baseURL, + 'static/favicons/favicon-notebook.ico' + ); const busyIcon = URLExt.join(baseURL, 'static/favicons/favicon-busy-1.ico'); const updateBrowserFavicon = (