Skip to content

Commit 1b31a37

Browse files
committed
fix: display the correct about box if jupyter notebook command is used to start the server
1 parent d7bf152 commit 1b31a37

File tree

2 files changed

+36
-14
lines changed

2 files changed

+36
-14
lines changed

nbclassic/static/base/js/namespace.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ define(function(){
7373
// tree
7474
jglobal('SessionList','tree/js/sessionlist');
7575

76-
Jupyter.version = "0.4.4";
76+
Jupyter.version = "0.5.0.dev0";
7777
Jupyter._target = '_blank';
7878

7979
return Jupyter;

nbclassic/static/notebook/js/about.js

+35-13
Original file line numberDiff line numberDiff line change
@@ -9,17 +9,31 @@ requirejs([
99
], function ($, dialog, i18n, _, IPython) {
1010
'use strict';
1111
$('#notebook_about').click(function () {
12+
// The baseUrlPrefix is only injected in the document by nbclassic.
13+
const is_nbclassic = document.baseUrlPrefix !== undefined;
1214
// use underscore template to auto html escape
1315
if (sys_info) {
14-
var text = i18n.msg._('You are using Jupyter NbClassic.');
15-
text = text + '<br/><br/>';
16-
text = text + i18n.msg._('The version of the Jupyter server is: ');
17-
text = text + _.template('<b><%- version %></b>')({ version: sys_info.jupyter_server_version });
18-
if (sys_info.commit_hash) {
19-
text = text + _.template('-<%- hash %>')({ hash: sys_info.commit_hash });
16+
var text = '';
17+
if (is_nbclassic) {
18+
text = text + i18n.msg._('You are using Jupyter NbClassic.');
19+
text = text + '<br/><br/>';
20+
text = text + i18n.msg._('The version of the Jupyter server is: ');
21+
text = text + _.template('<b><%- version %></b>')({ version: sys_info.jupyter_server_version });
22+
if (sys_info.commit_hash) {
23+
text = text + _.template('-<%- hash %>')({ hash: sys_info.commit_hash });
24+
}
25+
text = text + '<br/>';
26+
text = text + 'To get the version of nbclassic, run in a terminal: jupyter nbclassic --version';
27+
}
28+
else {
29+
text = text + i18n.msg._('You are using Jupyter Notebook.');
30+
text = text + '<br/><br/>';
31+
text = text + i18n.msg._('The version of the notebook server is: ');
32+
text = text + _.template('<b><%- version %></b>')({ version: sys_info.notebook_version });
33+
if (sys_info.commit_hash) {
34+
text = text + _.template('-<%- hash %>')({ hash: sys_info.commit_hash });
35+
}
2036
}
21-
text = text + '<br/>';
22-
text = text + 'To get the version of nbclassic, run in a terminal: jupyter nbclassic --version';
2337
text = text + '<br/>';
2438
text = text + i18n.msg._('The server is running on this version of Python:');
2539
text = text + _.template('<br/><pre>Python <%- pyver %></pre>')({
@@ -36,11 +50,19 @@ requirejs([
3650
body.append($('<h4/>').text(i18n.msg._('Cannot find sys_info!')));
3751
body.append($('<p/>').html(text));
3852
}
39-
dialog.modal({
40-
title: i18n.msg._('About Jupyter NbClassic'),
41-
body: body,
42-
buttons: { 'OK': {} }
43-
});
53+
if (is_nbclassic) {
54+
dialog.modal({
55+
title: i18n.msg._('About Jupyter NbClassic'),
56+
body: body,
57+
buttons: { 'OK': {} }
58+
});
59+
} else {
60+
dialog.modal({
61+
title: i18n.msg._('About Jupyter Notebook'),
62+
body: body,
63+
buttons: { 'OK': {} }
64+
});
65+
}
4466
try {
4567
IPython.notebook.session.kernel.kernel_info(function (data) {
4668
kinfo.html($('<pre/>').text(data.content.banner));

0 commit comments

Comments
 (0)