feat: organise router path

This commit is contained in:
2024-07-27 19:19:36 +02:00
parent 8313323ca1
commit 3c1d275634
7 changed files with 88 additions and 16 deletions

View File

@@ -1,4 +1,4 @@
from dash import html
from dash import html, dcc
from ..datalake import stages
from ..libs.stage.stage import AbstractStage
@@ -6,13 +6,15 @@ from ..libs.stage.stage import AbstractStage
def html_list_schema(stage:AbstractStage, with_tables=True):
""" 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 = [
html.Span(
dcc.Link(
schema,
href=schema_baseurl + schema,
className="text-lg text-bold"
),
html_list_table(stage, schema)
@@ -25,9 +27,12 @@ def html_list_schema(stage:AbstractStage, with_tables=True):
return html.Ul(
[
html.Li(
schema,
className="text-lg text-bold"
) for schema in stage.schemas()
dcc.Link(
schema,
href=schema_baseurl + schema,
className="text-lg text-bold"
),
) for schema in stage.schemas()
],
className=ul_classes
)
@@ -36,9 +41,16 @@ def html_list_schema(stage:AbstractStage, with_tables=True):
def html_list_table(stage:AbstractStage, schema:str):
""" Build html list of table in stage """
table_baseurl = f"/stg/{stage.name}/schm/{schema}/table/"
return html.Ul(
[
html.Li(table) for table in stage.tables(schema=schema)
html.Li(
dcc.Link(
table,
href=table_baseurl + table,
className="text-lg text-bold"
),
) for table in stage.tables(schema=schema)
],
className="ml-4"
)
@@ -51,10 +63,11 @@ layout = html.Div([
children=[
html.Li(
children=[
html.Span(
dcc.Link(
stagename,
href=f"/stage/{stagename}",
className="text-2xl text-center p-2 bg-amber-100 rounded shadow"
),
),
html_list_schema(stage)
],
className="flex-1 bg-gray-100 rounded flex flex-col shadow"

11
dashboard/pages/schema.py Normal file
View File

@@ -0,0 +1,11 @@
from dash import html
from ..datalake import stages
from ..libs.stage.stage import AbstractStage
def layout(stage_name=None, schema_name=None):
return html.Div([
html.H2(f"Stage - {stage_name}"),
html.H3(f"Schema - {schema_name}"),
])

10
dashboard/pages/stage.py Normal file
View File

@@ -0,0 +1,10 @@
from dash import html
from ..datalake import stages
from ..libs.stage.stage import AbstractStage
def layout(stage_name=None):
stage = stages[stage_name]
return html.Div([
html.H2(f"Stage - {stage_name}")
])

13
dashboard/pages/table.py Normal file
View File

@@ -0,0 +1,13 @@
from dash import html
from ..datalake import stages
from ..libs.stage.stage import AbstractStage
def layout(stage_name=None, schema_name=None, table_name=None):
return html.Div([
html.H2(f"Stage - {stage_name}"),
html.H3(f"Schema - {schema_name}"),
html.H4(f"Table - {table_name}"),
])