plesna/dashboard/app.py

65 lines
1.7 KiB
Python
Raw Normal View History

2024-07-27 13:55:20 +00:00
import dash
2024-08-07 09:39:33 +00:00
from dash import Dash, dcc, html
from .datalake import stages
2024-08-07 09:39:33 +00:00
from .pages import config, home, repository, schema, table
2024-07-27 13:55:20 +00:00
2024-08-07 09:39:33 +00:00
external_scripts = [{"src": "https://cdn.tailwindcss.com"}]
2024-07-27 16:21:42 +00:00
# external_script = ["https://tailwindcss.com/", {"src": "https://cdn.tailwindcss.com"}]
2024-08-07 09:39:33 +00:00
app = Dash(
__name__,
use_pages=True,
external_scripts=external_scripts,
suppress_callback_exceptions=True,
)
2024-07-27 16:21:42 +00:00
app.scripts.config.serve_locally = True
2024-07-27 17:19:36 +00:00
dash.register_page(
2024-08-07 09:39:33 +00:00
home.__name__,
path="/",
2024-07-27 17:19:36 +00:00
layout=home.layout,
)
2024-08-07 09:39:33 +00:00
dash.register_page(config.__name__, path="/config", layout=config.layout)
2024-07-27 17:19:36 +00:00
dash.register_page(
2024-08-07 09:39:33 +00:00
repository.__name__,
path_template="/repository/<repository_name>",
layout=repository.layout_factory(stages),
2024-07-27 17:19:36 +00:00
)
dash.register_page(
2024-08-07 09:39:33 +00:00
schema.__name__,
path_template="/stg/<repository_name>/schema/<schema_name>",
layout=schema.layout_factory(stages),
2024-07-27 17:19:36 +00:00
)
dash.register_page(
table.__name__,
2024-08-07 09:39:33 +00:00
path_template="/stg/<repository_name>/schm/<schema_name>/table/<table_name>",
layout=table.layout_factory(stages),
2024-07-27 17:19:36 +00:00
)
table.callback_factory(app)
2024-07-27 13:55:20 +00:00
2024-08-07 09:39:33 +00:00
app.layout = html.Div(
[
html.Div(
[
dcc.Link(
html.H1(
"Plesna",
),
href="/",
className="text-4xl p-4 text-center grow align-baseline",
),
dcc.Link(
"Config",
href="/config",
className="flex-none hover:bg-amber-100 p-4 align-middle",
),
],
className="bg-amber-300 flex flex-row shadow",
2024-07-27 16:21:42 +00:00
),
2024-08-07 09:39:33 +00:00
dash.page_container,
]
)
2024-07-27 13:55:20 +00:00
2024-08-07 09:39:33 +00:00
if __name__ == "__main__":
2024-07-27 13:55:20 +00:00
app.run(debug=True)