ソースを参照

Thread the config data through

Steven Silvester 8 年 前
コミット
caca1800c0
2 ファイル変更11 行追加8 行削除
  1. 6 2
      jupyterlab/__init__.py
  2. 5 6
      jupyterlab/lab.html

+ 6 - 2
jupyterlab/__init__.py

@@ -76,7 +76,6 @@ class LabHandler(IPythonHandler):
         config = dict(
             static_prefix=static_prefix,
             page_title='JupyterLab Alpha Preview',
-            terminals_available=self.settings['terminals_available'],
             mathjax_url=self.mathjax_url,
             jupyterlab_main=main,
             jupyterlab_css=css_files,
@@ -86,6 +85,10 @@ class LabHandler(IPythonHandler):
             #mathjax_config=self.mathjax_config # for the next release of the notebook
         )
 
+        configData = dict(
+            terminalsAvailable=self.settings.get('terminals_available', False),
+        )
+
         # Gather the lab extension files and entry points.
         # Make sure we only load an extension once for each name.
         seen = set()
@@ -112,10 +115,11 @@ class LabHandler(IPythonHandler):
             if python_module:
                 try:
                     value = get_labextension_config_python(python_module)
-                    config.update(value)
+                    configData.update(value)
                 except Exception as e:
                     self.log.error(e)
 
+        config['jupyterlab_config'] = configData
         self.write(self.render_template('lab.html', **config))
 
     def get_template(self, name):

+ 5 - 6
jupyterlab/lab.html

@@ -17,12 +17,11 @@ Distributed under the terms of the Modified BSD License.
   {% endblock %}
 
   <script id='jupyter-config-data' type="application/json">{
-  "baseUrl": "{{base_url | urlencode}}",
-  "hubHost": "{{hub_host | urlencode}}",
-  "hubPrefix": "{{hub_prefix | urlencode}}",
-  "wsUrl": "{{ws_url| urlencode}}",
-  "notebookPath": "{{notebook_path | urlencode}}",
-  "terminalsAvailable": "{{terminals_available}}"
+    {% for key, value in jupyterlab_config.items() -%}
+    "{{ key }}": "{{ value }}",
+    {% endfor -%}
+    "baseUrl": "{{base_url | urlencode}}",
+    "wsUrl": "{{ws_url | urlencode}}"
   }</script>
 
   {% block favicon %}<link rel="shortcut icon" type="image/x-icon" href="/static/base/images/favicon.ico">{% endblock %}