fix(admin): sidebar hamburger menu for mobile, remove auto Cantaloupe sync

- Replace broken icon-only sidebar collapse with off-canvas hamburger menu
  that slides in from left (hidden by default on <768px)
- Add sidebar overlay backdrop, auto-close on nav/logout
- Rename 'Cantaloupe Sync' to 'Import' in sidebar and 'Excel Import' in page
- Remove 'Sync Now' button and backend subprocess auto-export entirely
- Keep manual Excel file upload as the only import path
- Update empty-state text and upload handler to work without Sync Now btn
This commit is contained in:
Leo
2026-05-22 16:08:07 -04:00
parent 301c3d5fb1
commit cd1f04a519
2 changed files with 73 additions and 83 deletions
+5 -37
View File
@@ -386,7 +386,7 @@ async def run_sync(
file_path: Optional[str] = Query(None, description="Server-side path to Excel file"),
):
"""
Run a full Cantaloupe sync from an Excel file.
Import an Excel file into a staged batch for review.
Accepts either:
- An uploaded Excel file (multipart form)
@@ -416,42 +416,10 @@ async def run_sync(
excel_path = str(p)
display_path = file_path
else:
# Try subprocess call to cantaloupe export
try:
import subprocess
import sys
cantaloupe_dir = os.path.expanduser("~/projects/cantaloupe-downloader")
result = subprocess.run(
[sys.executable, "-m", "cantaloupe", "export", "--scheduled"],
capture_output=True, text=True, timeout=120,
cwd=cantaloupe_dir,
)
if result.returncode != 0:
raise HTTPException(
status_code=400,
detail=f"Cantaloupe export failed: {result.stderr[:500]}"
)
# Parse output to find the exported file path
for line in result.stdout.splitlines() + result.stderr.splitlines():
line = line.strip()
if line and Path(line).exists() and line.endswith((".xlsx", ".xls")):
excel_path = line
display_path = line
break
else:
raise HTTPException(
status_code=400,
detail="Cantaloupe export ran but produced no recognizable file path. Provide file upload or file_path parameter."
)
except FileNotFoundError:
raise HTTPException(
status_code=400,
detail="No file provided and cantaloupe module not found. Upload an Excel file or provide file_path."
)
except HTTPException:
raise
except Exception as e:
raise HTTPException(status_code=500, detail=f"Cantaloupe export error: {e}")
raise HTTPException(
status_code=400,
detail="No file provided. Upload an Excel file to import asset data."
)
conn = _get_db()
try: