Fix workflow permissions, expander flickering, and column KeyError
Browse files- Add permissions: contents: write to workflow (fixes 403 on git push)
- Replace border/padding CSS on expanders and metrics with box-shadow (no layout impact)
- Guard working_df against missing columns from stale QueryChat filter
- .github/workflows/keep_alive.yml +3 -0
- app.py +3 -1
- src/ui_theme.py +4 -6
.github/workflows/keep_alive.yml
CHANGED
|
@@ -5,6 +5,9 @@ on:
|
|
| 5 |
- cron: '0 5 * * *' # Daily at 05:00 UTC
|
| 6 |
workflow_dispatch: # Allow manual trigger
|
| 7 |
|
|
|
|
|
|
|
|
|
|
| 8 |
jobs:
|
| 9 |
heartbeat:
|
| 10 |
runs-on: ubuntu-latest
|
|
|
|
| 5 |
- cron: '0 5 * * *' # Daily at 05:00 UTC
|
| 6 |
workflow_dispatch: # Allow manual trigger
|
| 7 |
|
| 8 |
+
permissions:
|
| 9 |
+
contents: write
|
| 10 |
+
|
| 11 |
jobs:
|
| 12 |
heartbeat:
|
| 13 |
runs-on: ubuntu-latest
|
app.py
CHANGED
|
@@ -392,7 +392,9 @@ if cleaned_df is None or not y_cols:
|
|
| 392 |
# If QueryChat is active, use its filtered df
|
| 393 |
if st.session_state.qc is not None:
|
| 394 |
working_df = get_filtered_pandas_df(st.session_state.qc)
|
| 395 |
-
if
|
|
|
|
|
|
|
| 396 |
working_df = cleaned_df
|
| 397 |
else:
|
| 398 |
working_df = cleaned_df
|
|
|
|
| 392 |
# If QueryChat is active, use its filtered df
|
| 393 |
if st.session_state.qc is not None:
|
| 394 |
working_df = get_filtered_pandas_df(st.session_state.qc)
|
| 395 |
+
# Fall back if filtered df is empty or missing expected columns
|
| 396 |
+
required = {date_col} | set(y_cols)
|
| 397 |
+
if working_df.empty or not required.issubset(working_df.columns):
|
| 398 |
working_df = cleaned_df
|
| 399 |
else:
|
| 400 |
working_df = cleaned_df
|
src/ui_theme.py
CHANGED
|
@@ -72,11 +72,10 @@ def apply_miami_theme() -> None:
|
|
| 72 |
box-shadow: none;
|
| 73 |
}}
|
| 74 |
|
| 75 |
-
/* ---- Expander card borders ---- */
|
| 76 |
div[data-testid="stExpander"] {{
|
| 77 |
-
|
| 78 |
border-radius: 8px;
|
| 79 |
-
padding: 0.75rem;
|
| 80 |
}}
|
| 81 |
|
| 82 |
/* ---- Sidebar header accent ---- */
|
|
@@ -89,12 +88,11 @@ def apply_miami_theme() -> None:
|
|
| 89 |
color: {MIAMI_RED};
|
| 90 |
}}
|
| 91 |
|
| 92 |
-
/* ---- Metric cards ---- */
|
| 93 |
div[data-testid="stMetric"] {{
|
| 94 |
background-color: {_LIGHT_GRAY};
|
| 95 |
-
|
| 96 |
border-radius: 6px;
|
| 97 |
-
padding: 0.75rem 1rem;
|
| 98 |
}}
|
| 99 |
div[data-testid="stMetric"] label {{
|
| 100 |
color: {_BLACK};
|
|
|
|
| 72 |
box-shadow: none;
|
| 73 |
}}
|
| 74 |
|
| 75 |
+
/* ---- Expander card borders (box-shadow to avoid layout shift) ---- */
|
| 76 |
div[data-testid="stExpander"] {{
|
| 77 |
+
box-shadow: 0 0 0 1px {_BORDER_GRAY};
|
| 78 |
border-radius: 8px;
|
|
|
|
| 79 |
}}
|
| 80 |
|
| 81 |
/* ---- Sidebar header accent ---- */
|
|
|
|
| 88 |
color: {MIAMI_RED};
|
| 89 |
}}
|
| 90 |
|
| 91 |
+
/* ---- Metric cards (inset shadow for left accent, no layout impact) ---- */
|
| 92 |
div[data-testid="stMetric"] {{
|
| 93 |
background-color: {_LIGHT_GRAY};
|
| 94 |
+
box-shadow: inset 4px 0 0 0 {MIAMI_RED};
|
| 95 |
border-radius: 6px;
|
|
|
|
| 96 |
}}
|
| 97 |
div[data-testid="stMetric"] label {{
|
| 98 |
color: {_BLACK};
|