plesna/dashboard/pages/home.py

52 lines
1.2 KiB
Python

from dash import html
from ..datalake import stages
from ..libs.stage.stage import AbstractStage
def html_list_schema(stage:AbstractStage, with_tables=True):
""" Build html list of schema in stage """
if with_tables:
return html.Ul(
[
html.Li(
children = [
html.Span(schema),
html_list_table(stage, schema)
]
) for schema in stage.schemas()
]
)
return html.Ul(
[
html.Li(schema) for schema in stage.schemas()
]
)
def html_list_table(stage:AbstractStage, schema:str):
""" Build html list of table in stage """
return html.Ul(
[
html.Li(table) for table in stage.tables(schema=schema)
]
)
layout = html.Div([
html.H1('This is our Home page'),
html.Div(children=[
html.Ul(
children=[
html.Li(
children=[
html.Span(stagename),
html_list_schema(stage)
]
) for stagename, stage in stages.items()
]
)
]),
])