mirror of
https://github.com/jupyter/notebook.git
synced 2025-01-24 12:05:22 +08:00
Only display terminals in dashboard if terminals are available
This commit is contained in:
parent
65e664b143
commit
4025b57ed8
@ -173,6 +173,7 @@ class NotebookWebApplication(web.Application):
|
||||
mathjax_url=ipython_app.mathjax_url,
|
||||
config=ipython_app.config,
|
||||
jinja2_env=env,
|
||||
terminals_available=False, # Set later if terminals are available
|
||||
)
|
||||
|
||||
# allow custom overrides for the tornado web app.
|
||||
@ -765,10 +766,9 @@ class NotebookApp(BaseIPythonApplication):
|
||||
try:
|
||||
from .terminal import initialize
|
||||
initialize(self.web_app)
|
||||
self.web_app.terminals_available = True
|
||||
self.web_app.settings['terminals_available'] = True
|
||||
except ImportError as e:
|
||||
self.log.info("Terminals not available (error was %s)", e)
|
||||
self.web_app.terminals_available = False
|
||||
|
||||
def init_signal(self):
|
||||
if not sys.platform.startswith('win'):
|
||||
|
@ -46,7 +46,11 @@ require([
|
||||
kernel_list = new kernellist.KernelList('#running_list', $.extend({
|
||||
session_list: session_list},
|
||||
common_options));
|
||||
terminal_list = new terminallist.TerminalList('#terminal_list', common_options);
|
||||
|
||||
if (utils.get_body_data("terminalsAvailable") === "True") {
|
||||
terminal_list = new terminallist.TerminalList('#terminal_list', common_options);
|
||||
}
|
||||
|
||||
login_widget = new loginwidget.LoginWidget('#login_widget', common_options);
|
||||
|
||||
$('#new_notebook').click(function (e) {
|
||||
|
@ -12,6 +12,7 @@
|
||||
|
||||
data-base-url="{{base_url}}"
|
||||
data-notebook-path="{{notebook_path}}"
|
||||
data-terminals-available="{{terminals_available}}"
|
||||
|
||||
{% endblock %}
|
||||
|
||||
@ -24,7 +25,9 @@ data-notebook-path="{{notebook_path}}"
|
||||
<ul id="tabs" class="nav nav-tabs">
|
||||
<li class="active"><a href="#notebooks" data-toggle="tab">Notebooks</a></li>
|
||||
<li><a href="#running" data-toggle="tab">Running</a></li>
|
||||
{% if terminals_available %}
|
||||
<li><a href="#terminals" data-toggle="tab">Terminals</a></li>
|
||||
{% endif %}
|
||||
<li><a href="#clusters" data-toggle="tab">Clusters</a></li>
|
||||
</ul>
|
||||
|
||||
@ -80,7 +83,8 @@ data-notebook-path="{{notebook_path}}"
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
{% if terminals_available %}
|
||||
<div id="terminals" class="tab-pane">
|
||||
|
||||
<div id="terminal_toolbar" class="row">
|
||||
@ -101,6 +105,7 @@ data-notebook-path="{{notebook_path}}"
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
<div id="clusters" class="tab-pane">
|
||||
|
||||
|
@ -55,7 +55,8 @@ class TreeHandler(IPythonHandler):
|
||||
self.write(self.render_template('tree.html',
|
||||
page_title=page_title,
|
||||
notebook_path=path,
|
||||
breadcrumbs=breadcrumbs
|
||||
breadcrumbs=breadcrumbs,
|
||||
terminals_available=self.settings['terminals_available'],
|
||||
))
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user