-
-
Notifications
You must be signed in to change notification settings - Fork 530
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
css url of Terminal widget not correct in jupyter lab preview #2643
Comments
If I go to https://DOMAIN/mt-workspace/user/masma/panel-preview/render/shared/Untitled1.ipynb and look at the page source I see the below. I.e. it looks like js is served corrected but css is not. <html>
<body>
<!--StartFragment-->
<!DOCTYPE html>
--
| <html lang="en">
|
| <head>
|
| <meta charset="utf-8">
| <title>Panel Application</title>
|
|
|
|
| <link rel="stylesheet" href="static/extensions/panel/bundled/terminal/[email protected]/css/xterm.css" type="text/css" />
| <link rel="stylesheet" href="/mt-workspace/user/masma/panel-preview/static/extensions/panel/css/widgets.css" type="text/css" />
| <link rel="stylesheet" href="/mt-workspace/user/masma/panel-preview/static/extensions/panel/css/markdown.css" type="text/css" />
| <link rel="stylesheet" href="/mt-workspace/user/masma/panel-preview/static/extensions/panel/css/loading.css" type="text/css" />
| <link rel="stylesheet" href="/mt-workspace/user/masma/panel-preview/static/extensions/panel/css/json.css" type="text/css" />
| <link rel="stylesheet" href="/mt-workspace/user/masma/panel-preview/static/extensions/panel/css/card.css" type="text/css" />
| <link rel="stylesheet" href="/mt-workspace/user/masma/panel-preview/static/extensions/panel/css/dataframe.css" type="text/css" />
| <link rel="stylesheet" href="/mt-workspace/user/masma/panel-preview/static/extensions/panel/css/alerts.css" type="text/css" />
| <style>
|
| .bk.pn-loading.arcs:before {
| background-image: url("data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHhtbG5zOnhsaW5rPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5L3hsaW5rIiBzdHlsZT0ibWFyZ2luOiBhdXRvOyBiYWNrZ3JvdW5kOiBub25lOyBkaXNwbGF5OiBibG9jazsgc2hhcGUtcmVuZGVyaW5nOiBhdXRvOyIgdmlld0JveD0iMCAwIDEwMCAxMDAiIHByZXNlcnZlQXNwZWN0UmF0aW89InhNaWRZTWlkIj4gIDxjaXJjbGUgY3g9IjUwIiBjeT0iNTAiIHI9IjMyIiBzdHJva2Utd2lkdGg9IjgiIHN0cm9rZT0iI2MzYzNjMyIgc3Ryb2tlLWRhc2hhcnJheT0iNTAuMjY1NDgyNDU3NDM2NjkgNTAuMjY1NDgyNDU3NDM2NjkiIGZpbGw9Im5vbmUiIHN0cm9rZS1saW5lY2FwPSJyb3VuZCI+ICAgIDxhbmltYXRlVHJhbnNmb3JtIGF0dHJpYnV0ZU5hbWU9InRyYW5zZm9ybSIgdHlwZT0icm90YXRlIiByZXBlYXRDb3VudD0iaW5kZWZpbml0ZSIgZHVyPSIxcyIga2V5VGltZXM9IjA7MSIgdmFsdWVzPSIwIDUwIDUwOzM2MCA1MCA1MCI+PC9hbmltYXRlVHJhbnNmb3JtPiAgPC9jaXJjbGU+PC9zdmc+")
| }
|
| </style>
|
|
|
| <script type="text/javascript" src="/mt-workspace/user/masma/panel-preview/static/extensions/panel/bundled/terminal/[email protected]/lib/xterm.js"></script>
| <script type="text/javascript" src="/mt-workspace/user/masma/panel-preview/static/extensions/panel/bundled/terminal/[email protected]/lib/xterm-addon-web-links.js"></script>
| <script type="text/javascript" src="/mt-workspace/user/masma/panel-preview/static/js/bokeh.min.js?v=36c1f44e80c69a608452746fd99d7b45d5d61daff899a8c1ff778875d4ffa3710cec84b8ff7e18dd077026bd90830d8c46741a3d492252d1e291d4e254078e8d"></script>
| <script type="text/javascript" src="/mt-workspace/user/masma/panel-preview/static/js/bokeh-widgets.min.js?v=afa4dcefab2d124480814f7ec2dbd6a60dea97f575c9c34bb50526c99053d7dccf1c23c66b17055b8cc27533be74556fbbe0677a3a9a5bfe84f8a12aa8a2306d"></script>
| <script type="text/javascript" src="/mt-workspace/user/masma/panel-preview/static/js/bokeh-tables.min.js?v=69a2fcb5cdc0a04e5d4d898d217b3e8bf3ae59d039cf14d8f6d031f26a88100cec4f7cc55d6e4a81b41dc140f57a0b077a9e08deaed799a339d69d0ada9beed8"></script>
| <script type="text/javascript" src="/mt-workspace/user/masma/panel-preview/static/extensions/panel/panel.min.js"></script>
| <script type="text/javascript">
| Bokeh.set_log_level("info");
| </script>
<!--EndFragment-->
</body>
</html> |
Its the same problem on Binder. To reproduce open https://mybinder.org/v2/gh/holoviz/panel/master?urlpath=lab/tree/examples and create a new jupyter notebook with import sys
import uuid
import logging
import panel as pn
import bokeh
from panel.io.jupyter_server_extension import url_path_join
pn.extension("terminal", sizing_mode='stretch_width') pn.Column(
pn.__version__,
pn.__file__,
pn.state.base_url,
pn.state.rel_path,
pn.state.cache.get("handlers", "not included"),
str(bokeh.embed.bundle.extension_dirs),
url_path_join(pn.state.rel_path, r"panel-preview/static/(.*)"),
pn.widgets.Terminal(),
).servable() Open the preview and notice the problem |
Do you know why the terminal css does not get the base_url as prefix or where to look for the explanation @philippjfr ? |
I can see it does not work locally either The css file is served though at http://localhost:8888/panel-preview/static/extensions/panel/bundled/terminal/[email protected]/css/xterm.css |
This is a fix that has been working for me for months now def _fix_jupyter_preview():
""" Fixes https://github.com/holoviz/panel/issues/2643"""
@property
def css_files(self):
if pn.state.rel_path:
files = [f'{pn.state.rel_path}/{file}' for file in super(pn.io.resources.Resources, self).css_files]
else:
files = super(pn.io.resources.Resources, self).css_files
for model in param.concrete_descendents(pn.reactive.ReactiveHTML).values():
if hasattr(model, '__css__'):
for css_file in model.__css__:
if css_file not in files:
files.append(css_file)
for cssf in config.css_files:
if os.path.isfile(cssf) or cssf in files:
continue
files.append(cssf)
if self.mode == 'server':
if pn.state.rel_path:
dist_dir = f'{pn.state.rel_path}/{LOCAL_DIST}'
else:
dist_dir = LOCAL_DIST
else:
dist_dir = CDN_DIST
for cssf in glob.glob(str(DIST_DIR / 'css' / '*.css')):
if self.mode == 'inline':
break
files.append(dist_dir + f'css/{os.path.basename(cssf)}')
return files
pn.io.resources.Resources.css_files = css_files |
panel 0.12.1
It's trying to find the css at https://DOMAIN/mt-workspace/user/masma/panel-preview/render/shared/static/extensions/panel/bundled/terminal/[email protected]/css/xterm.css
But it's actually served at https://DOMAIN/mt-workspace/user/masma/panel-preview/static/extensions/panel/bundled/terminal/[email protected]/css/xterm.css
This issue is related to #2545
The text was updated successfully, but these errors were encountered: