fix(dashboard): resolved NameError and handled NoneType for media export

This commit is contained in:
Sanjeev Kumar 2025-12-14 07:55:29 +05:30
parent 604a50ce17
commit 73735b0669

View file

@ -548,6 +548,7 @@ def main():
st.divider() st.divider()
if selected_sub:
# Export options # Export options
st.subheader("📤 Export Data") st.subheader("📤 Export Data")
@ -626,7 +627,7 @@ def main():
else: else:
st.info(f"No media found for {selected_sub}. Run with `--mode full` to download media.") st.info(f"No media found for {selected_sub}. Run with `--mode full` to download media.")
with tab6: with tab_map["📋 Job History"]:
st.header("📋 Job History") st.header("📋 Job History")
try: try:
@ -680,7 +681,7 @@ def main():
st.error(f"Failed to load job history: {e}") st.error(f"Failed to load job history: {e}")
st.info("Make sure the database is initialized.") st.info("Make sure the database is initialized.")
with tab7: with tab_map["🔌 Integrations"]:
st.header("🔌 Integrations & Settings") st.header("🔌 Integrations & Settings")
# REST API Section # REST API Section
@ -789,11 +790,14 @@ def main():
# Parquet Export # Parquet Export
st.subheader("📦 Parquet Export") st.subheader("📦 Parquet Export")
all_targets = available_data['subreddits'] + available_data['users']
col1, col2 = st.columns(2) col1, col2 = st.columns(2)
with col1: with col1:
export_sub = st.selectbox("Select subreddit to export", subreddits, key="parquet_export") export_sub = st.selectbox("Select target to export", all_targets, key="parquet_export")
with col2: with col2:
if st.button("📦 Export to Parquet"): if st.button("📦 Export to Parquet"):
if export_sub:
target_name = export_sub.replace('r_', '').replace('u_', '') target_name = export_sub.replace('r_', '').replace('u_', '')
with st.spinner(f"Exporting {target_name} to Parquet..."): with st.spinner(f"Exporting {target_name} to Parquet..."):
import subprocess import subprocess
@ -808,6 +812,8 @@ def main():
st.code(result.stdout[-500:] if len(result.stdout) > 500 else result.stdout) st.code(result.stdout[-500:] if len(result.stdout) > 500 else result.stdout)
else: else:
st.error(f"❌ Export failed: {result.stderr}") st.error(f"❌ Export failed: {result.stderr}")
else:
st.error("Select a target first")
# List existing parquet files # List existing parquet files
parquet_dir = Path("data/parquet") parquet_dir = Path("data/parquet")