Subh775 commited on
Commit
66c759f
·
1 Parent(s): 119af74

auto-download report fix

Browse files
Files changed (2) hide show
  1. backend/server.py +1 -1
  2. frontend/vehicles.html +3 -8
backend/server.py CHANGED
@@ -139,7 +139,7 @@ def get_report(video_id: str, name: str):
139
  return FileResponse(str(path), media_type=media)
140
 
141
 
142
- @app.get("/reports/zip/{video_id}")
143
  def download_all_reports(video_id: str):
144
  print(f"[BACKEND] ZIP request for {video_id}")
145
  base_path = REPORT_DIR / video_id
 
139
  return FileResponse(str(path), media_type=media)
140
 
141
 
142
+ @app.get("/bundle/{video_id}")
143
  def download_all_reports(video_id: str):
144
  print(f"[BACKEND] ZIP request for {video_id}")
145
  base_path = REPORT_DIR / video_id
frontend/vehicles.html CHANGED
@@ -338,7 +338,7 @@
338
  </a>
339
  <a onclick="switchTab('reports')" id="nav-reports"
340
  class="flex items-center px-4 py-2.5 rounded-lg transition cursor-pointer nav-item-inactive">
341
- <i class="fa-solid fa-file-lines w-6"></i> <span class="font-medium">Reports</span>
342
  </a>
343
  <a onclick="switchTab('settings')" id="nav-settings"
344
  class="flex items-center px-4 py-2.5 rounded-lg transition cursor-pointer nav-item-inactive">
@@ -1510,15 +1510,10 @@
1510
 
1511
  // Auto-Download Logic (Respects live toggle state)
1512
  if (document.getElementById('sv-auto-download').classList.contains('active')) {
1513
- // Download the full bundle ZIP
1514
  setTimeout(() => {
1515
  console.log('[UrbanFlow] Fetching ZIP bundle for:', d.video_id);
1516
- const link = document.createElement('a');
1517
- link.href = `/reports/zip/${d.video_id}`;
1518
- link.download = `UrbanFlow_Reports.zip`;
1519
- document.body.appendChild(link);
1520
- link.click();
1521
- document.body.removeChild(link);
1522
  }, 1000);
1523
  }
1524
  });
 
338
  </a>
339
  <a onclick="switchTab('reports')" id="nav-reports"
340
  class="flex items-center px-4 py-2.5 rounded-lg transition cursor-pointer nav-item-inactive">
341
+ <i class="fa-solid fa-file-lines w-6"></i> <span class="font-medium">Artifacts</span>
342
  </a>
343
  <a onclick="switchTab('settings')" id="nav-settings"
344
  class="flex items-center px-4 py-2.5 rounded-lg transition cursor-pointer nav-item-inactive">
 
1510
 
1511
  // Auto-Download Logic (Respects live toggle state)
1512
  if (document.getElementById('sv-auto-download').classList.contains('active')) {
1513
+ // Download the full bundle ZIP via direct navigation
1514
  setTimeout(() => {
1515
  console.log('[UrbanFlow] Fetching ZIP bundle for:', d.video_id);
1516
+ window.open(`/bundle/${d.video_id}`, '_blank');
 
 
 
 
 
1517
  }, 1000);
1518
  }
1519
  });