Skip to content

Commit c3d8afe

Browse files
authored
Color fix in dashboard (#3439)
1 parent 06bc058 commit c3d8afe

File tree

4 files changed

+43
-20
lines changed

4 files changed

+43
-20
lines changed

dlt/_workspace/helpers/dashboard/dlt_dashboard.py

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,7 @@ def render_workspace_home(
8686
) -> List[Any]:
8787
"""Render the workspace-level home view (no pipeline selected)."""
8888
return [
89+
ui.section_marker(strings.app_section_name, has_content=True),
8990
build_home_header_row(dlt_profile_select, dlt_pipeline_select),
9091
mo.md(strings.app_title).center(),
9192
mo.md(strings.app_intro).center(),
@@ -185,7 +186,7 @@ def render_pipeline_home(
185186
)
186187
_pipeline_execution_exception = utils.build_exception_section(dlt_pipeline)
187188

188-
_stack = [ui.section_marker(strings.home_section_name)]
189+
_stack = [ui.section_marker(strings.home_section_name, has_content=dlt_pipeline is not None)]
189190
_stack.extend(
190191
render_pipeline_header_row(
191192
dlt_pipeline_name, dlt_profile_select, dlt_pipeline_select, _buttons
@@ -304,7 +305,9 @@ def section_info(
304305
Overview page of currently selected pipeline
305306
"""
306307

307-
_result = [ui.section_marker(strings.overview_section_name)]
308+
_result = [
309+
ui.section_marker(strings.overview_section_name, has_content=dlt_pipeline is not None)
310+
]
308311
_result.extend(
309312
ui.build_page_header(
310313
dlt_pipeline,
@@ -363,7 +366,7 @@ def section_schema(
363366
Show schema of the currently selected pipeline
364367
"""
365368

366-
_result = [ui.section_marker(strings.schema_section_name)]
369+
_result = [ui.section_marker(strings.schema_section_name, has_content=dlt_pipeline is not None)]
367370
_result.extend(
368371
ui.build_page_header(
369372
dlt_pipeline,
@@ -460,7 +463,9 @@ def section_browse_data_table_list(
460463
Show data of the currently selected pipeline
461464
"""
462465

463-
_result = [ui.section_marker(strings.browse_data_section_name)]
466+
_result = [
467+
ui.section_marker(strings.browse_data_section_name, has_content=dlt_pipeline is not None)
468+
]
464469
_result.extend(
465470
ui.build_page_header(
466471
dlt_pipeline,
@@ -705,7 +710,7 @@ def section_state(
705710
"""
706711
Show state of the currently selected pipeline
707712
"""
708-
_result = [ui.section_marker(strings.state_section_name)]
713+
_result = [ui.section_marker(strings.state_section_name, has_content=dlt_pipeline is not None)]
709714
_result.extend(
710715
ui.build_page_header(
711716
dlt_pipeline,
@@ -737,7 +742,7 @@ def section_trace(
737742
Show last trace of the currently selected pipeline
738743
"""
739744

740-
_result = [ui.section_marker(strings.trace_section_name)]
745+
_result = [ui.section_marker(strings.trace_section_name, has_content=dlt_pipeline is not None)]
741746
_result.extend(
742747
ui.build_page_header(
743748
dlt_pipeline,
@@ -851,7 +856,7 @@ def section_loads(
851856
Show loads of the currently selected pipeline
852857
"""
853858

854-
_result = [ui.section_marker(strings.loads_section_name)]
859+
_result = [ui.section_marker(strings.loads_section_name, has_content=dlt_pipeline is not None)]
855860
_result.extend(
856861
ui.build_page_header(
857862
dlt_pipeline,
@@ -964,7 +969,9 @@ def section_ibis_backend(
964969
"""
965970
Connects to ibis backend and makes it available in the datasources panel
966971
"""
967-
_result = [ui.section_marker(strings.ibis_backend_section_name)]
972+
_result = [
973+
ui.section_marker(strings.ibis_backend_section_name, has_content=dlt_pipeline is not None)
974+
]
968975
_result.extend(
969976
ui.build_page_header(
970977
dlt_pipeline,

dlt/_workspace/helpers/dashboard/dlt_dashboard_styles.css

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -56,22 +56,25 @@
5656

5757
/* add colors to cells */
5858

59-
/* Default: all sections get purple border and background */
60-
#App .marimo-cell .output-area {
59+
/* Default: all sections that have content get purple border and background */
60+
#App .marimo-cell .output-area:has(.section-marker.has-content) {
6161
border: 1px dashed var(--dlt-color-purple);
6262
background-color: var(--dlt-color-purple-background);
6363
}
6464

65-
/* All cells with section markers get margin-top */
66-
#App .marimo-cell .output-area:has(.section-marker) {
65+
66+
/* All cells with section markers and have content get margin-top */
67+
#App .marimo-cell .output-area:has(.section-marker.has-content) {
6768
margin-top: 0.5rem;
6869
}
6970

70-
/* Aqua sections - identified by section name in strings.py */
71-
#App .marimo-cell .output-area:has([data-section="home_section"]),
72-
#App .marimo-cell .output-area:has([data-section="schema_section"]),
73-
#App .marimo-cell .output-area:has([data-section="state_section"]),
74-
#App .marimo-cell .output-area:has([data-section="loads_section"]) {
71+
72+
/* Aqua sections - identified by section name in strings.py and the availability of content */
73+
#App .marimo-cell .output-area:has([data-section="workspace_home"].has-content),
74+
#App .marimo-cell .output-area:has([data-section="home_section"].has-content),
75+
#App .marimo-cell .output-area:has([data-section="schema_section"].has-content),
76+
#App .marimo-cell .output-area:has([data-section="state_section"].has-content),
77+
#App .marimo-cell .output-area:has([data-section="loads_section"].has-content) {
7578
background-color: var(--dlt-color-aqua-background);
7679
border: 1px dashed var(--dlt-color-aqua);
7780
}

dlt/_workspace/helpers/dashboard/strings.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
#
1919
# App general
2020
#
21+
app_section_name = "workspace_home"
2122
app_title = """
2223
# Welcome to the dltHub workspace dashboard...
2324
"""

dlt/_workspace/helpers/dashboard/ui_elements.py

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,18 @@ def build_page_header(
7878
]
7979

8080

81-
def section_marker(section_name: str) -> mo.Html:
82-
"""Create an invisible marker element to identify sections for CSS styling."""
83-
return mo.Html(f'<div class="section-marker" data-section="{section_name}" hidden"></div>')
81+
def section_marker(section_name: str, has_content: bool = False) -> mo.Html:
82+
"""Create an invisible marker element to identify sections for CSS styling.
83+
84+
Args:
85+
section_name: Name identifier for the section (e.g., "home_section", "schema_section")
86+
has_content: If True, adds 'has-content' class to enable CSS styling (borders, backgrounds).
87+
Should be True only when the section has actual content and is displayed.
88+
89+
Returns:
90+
Hidden HTML div element with section marker classes for CSS targeting.
91+
"""
92+
content_class = "has-content" if has_content else ""
93+
return mo.Html(
94+
f'<div class="section-marker {content_class}" data-section="{section_name}" hidden"></div>'
95+
)

0 commit comments

Comments
 (0)