How to render JupyterLab Service Session Time

HI Team,

I need your help. This is not bug.

We have a requirement where we want to show session time on JupyterLab’s top bar, whenever User get access to JupyterLab.
Let say we have session time 2Hrs, then in this case it should be shown on Jupyterlab.

Do we have any such configuration file where we can make changes related to session time configuration.

Please help me here. Thank you in advance.!

Thanks,
Sachin

By session time do you mean the time since the user opened JupyterLab? Or since the jupyterlab server was started on the machine?

For the first case this would mean keeping track of the time when the application is started, and add a UI element to the top area to display the elapsed time. This can be done with a (frontend only) JupyterLab extension.

Otherwise this might require having a Jupyter Server extension to be able to retrieve server specific information, and display it via the JupyterLab extension in the UI.

1 Like

Hi @jtp ,

Thank you for your response.

We have to have session time since the user opened JupyterLab.
Can you please share some example for JupyterLab extensions, how we can implement and integrate?

Here I have attached JupyterLab screenshot, we want to show session time at right top corner.

Hi @jtp & Team,

I’m waiting for your reference.
Since Im new to JupyterLab. Please help us here.

Thanks,
Sachin

Hey @Sachin_Sharma,

Here are a couple of resources to learn how to create JupyterLab extensions:

There might not be an exact example covering the top area, but it should be possible to adapt the existing ones to add widgets with app.shell.add(widget, 'top') instead.

1 Like

HI @jtp ,

I found an example GitHub - jupyterlab-contrib/jupyterlab-topbar-text: JupyterLab extension to display arbitrary text in the top bar adding text on top bar.
I have made changes accordingly as per our requirement and run it locally.
It is working fine on local machine.

But when I’m running it on server getting below error.

index.es6.js:288 Plugin ‘jupyterlab-topbar-text:plugin’ failed to activate.
(anonymous) @ index.es6.js:288
index.es6.js:289 Error: No provider for: jupyterlab-topbar:ITopBar.
at JupyterLab.Application.resolveRequiredService

Can you please help what else required for sever integration?