mirror of
https://github.com/Akkudoktor-EOS/EOS.git
synced 2025-10-11 11:56:17 +00:00
Make EOSdash use UI components from MonsterUI to ease further development. - Add a first menu with some dummy pages and the configuration page. - Make the configuration scrollable. - Add markdown component that uses markdown-it-py (same as used by the myth-parser for documentation generation). - Add bokeh (https://docs.bokeh.org/) component for charts - Added several prediction charts to demo - Add a footer that displays connection status with EOS server - Add logo and favicon Update EOS server: - Move error message generation to extra module - Use redirect instead of proxy Signed-off-by: Bobby Noelte <b0661n0e17e@gmail.com>
39 lines
1.1 KiB
Python
39 lines
1.1 KiB
Python
# Module taken from https://github.com/koaning/fh-altair
|
|
# MIT license
|
|
|
|
from typing import Optional
|
|
|
|
from bokeh.embed import components
|
|
from bokeh.models import Plot
|
|
from monsterui.franken import H4, Card, NotStr, Script
|
|
|
|
BokehJS = [
|
|
Script(src="https://cdn.bokeh.org/bokeh/release/bokeh-3.6.3.min.js", crossorigin="anonymous"),
|
|
Script(
|
|
src="https://cdn.bokeh.org/bokeh/release/bokeh-widgets-3.6.3.min.js",
|
|
crossorigin="anonymous",
|
|
),
|
|
Script(
|
|
src="https://cdn.bokeh.org/bokeh/release/bokeh-tables-3.6.3.min.js", crossorigin="anonymous"
|
|
),
|
|
Script(
|
|
src="https://cdn.bokeh.org/bokeh/release/bokeh-gl-3.6.3.min.js", crossorigin="anonymous"
|
|
),
|
|
Script(
|
|
src="https://cdn.bokeh.org/bokeh/release/bokeh-mathjax-3.6.3.min.js",
|
|
crossorigin="anonymous",
|
|
),
|
|
]
|
|
|
|
|
|
def Bokeh(plot: Plot, header: Optional[str] = None) -> Card:
|
|
"""Converts an Bokeh plot to a FastHTML FT component."""
|
|
script, div = components(plot)
|
|
if header:
|
|
header = H4(header, cls="mt-2")
|
|
return Card(
|
|
NotStr(div),
|
|
NotStr(script),
|
|
header=header,
|
|
)
|