Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: display the correct about box if jupyter notebook command is used #156

Merged
merged 1 commit into from
Oct 4, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion nbclassic/static/base/js/namespace.js
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ define(function(){
// tree
jglobal('SessionList','tree/js/sessionlist');

Jupyter.version = "0.4.4";
Jupyter.version = "0.5.0.dev0";
Jupyter._target = '_blank';

return Jupyter;
Expand Down
48 changes: 35 additions & 13 deletions nbclassic/static/notebook/js/about.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,31 @@ requirejs([
], function ($, dialog, i18n, _, IPython) {
'use strict';
$('#notebook_about').click(function () {
// The baseUrlPrefix is only injected in the document by nbclassic.
const is_nbclassic = document.baseUrlPrefix !== undefined;
// use underscore template to auto html escape
if (sys_info) {
var text = i18n.msg._('You are using Jupyter NbClassic.');
text = text + '<br/><br/>';
text = text + i18n.msg._('The version of the Jupyter server is: ');
text = text + _.template('<b><%- version %></b>')({ version: sys_info.jupyter_server_version });
if (sys_info.commit_hash) {
text = text + _.template('-<%- hash %>')({ hash: sys_info.commit_hash });
var text = '';
if (is_nbclassic) {
text = text + i18n.msg._('You are using Jupyter NbClassic.');
text = text + '<br/><br/>';
text = text + i18n.msg._('The version of the Jupyter server is: ');
text = text + _.template('<b><%- version %></b>')({ version: sys_info.jupyter_server_version });
if (sys_info.commit_hash) {
text = text + _.template('-<%- hash %>')({ hash: sys_info.commit_hash });
}
text = text + '<br/>';
text = text + 'To get the version of nbclassic, run in a terminal: jupyter nbclassic --version';
}
else {
text = text + i18n.msg._('You are using Jupyter Notebook.');
text = text + '<br/><br/>';
text = text + i18n.msg._('The version of the notebook server is: ');
text = text + _.template('<b><%- version %></b>')({ version: sys_info.notebook_version });
if (sys_info.commit_hash) {
text = text + _.template('-<%- hash %>')({ hash: sys_info.commit_hash });
}
}
text = text + '<br/>';
text = text + 'To get the version of nbclassic, run in a terminal: jupyter nbclassic --version';
text = text + '<br/>';
text = text + i18n.msg._('The server is running on this version of Python:');
text = text + _.template('<br/><pre>Python <%- pyver %></pre>')({
Expand All @@ -36,11 +50,19 @@ requirejs([
body.append($('<h4/>').text(i18n.msg._('Cannot find sys_info!')));
body.append($('<p/>').html(text));
}
dialog.modal({
title: i18n.msg._('About Jupyter NbClassic'),
body: body,
buttons: { 'OK': {} }
});
if (is_nbclassic) {
dialog.modal({
title: i18n.msg._('About Jupyter NbClassic'),
body: body,
buttons: { 'OK': {} }
});
} else {
dialog.modal({
title: i18n.msg._('About Jupyter Notebook'),
body: body,
buttons: { 'OK': {} }
});
}
try {
IPython.notebook.session.kernel.kernel_info(function (data) {
kinfo.html($('<pre/>').text(data.content.banner));
Expand Down