plesna/dashboard/components/lists.py

58 lines
1.6 KiB
Python
Raw Normal View History

2024-08-07 09:39:33 +00:00
from dash import dcc, html
2024-07-28 10:29:14 +00:00
2024-08-07 09:39:33 +00:00
from ..libs.repository.repository import AbstractRepository
def html_list_schema(stage:AbstractRepository, with_tables=True):
2024-07-28 10:29:14 +00:00
""" Build html list of schema in stage """
ul_classes = "ml-2"
schema_baseurl = f"/stg/{stage.name}/schema/"
if with_tables:
return html.Ul(
[
html.Li(
children = [
dcc.Link(
schema,
href=schema_baseurl + schema,
className="text-lg hover:underline"
),
html_list_table(stage, schema)
],
className=""
) for schema in stage.schemas()
],
className=ul_classes
)
return html.Ul(
[
html.Li(
dcc.Link(
schema,
href=schema_baseurl + schema,
className="text-lg hover:underline"
),
) for schema in stage.schemas()
],
className=ul_classes
)
2024-08-07 09:39:33 +00:00
def html_list_table(stage:AbstractRepository, schema:str):
2024-07-28 10:29:14 +00:00
""" Build html list of table in stage """
table_baseurl = f"/stg/{stage.name}/schm/{schema}/table/"
return html.Ul(
[
html.Li(
dcc.Link(
table,
href=table_baseurl + table,
className="hover:underline"
),
) for table in stage.tables(schema=schema)
],
className="ml-4"
)