Redesign jobs dashboard with unified table and progress bar
- Add overall progress bar showing completed/active/failed counts - Unify all job types into single table with Type column - Simplify status to Working/Pending/Failed badges - Remove NPM "Coming Soon" section - Add get_recent_activity() function for future activity feed - Fix dark mode CSS using CSS variables
This commit is contained in:
@@ -600,6 +600,40 @@ def get_active_tasks(db: Session, limit: int = 50) -> List[dict]:
|
||||
]
|
||||
|
||||
|
||||
def get_recent_activity(db: Session, limit: int = 20) -> List[dict]:
|
||||
"""
|
||||
Get recent task completions and failures for activity feed.
|
||||
|
||||
Args:
|
||||
db: Database session.
|
||||
limit: Maximum number of items to return.
|
||||
|
||||
Returns:
|
||||
List of recent activity items sorted by time descending.
|
||||
"""
|
||||
# Get recently completed and failed tasks
|
||||
tasks = (
|
||||
db.query(PyPICacheTask)
|
||||
.filter(PyPICacheTask.status.in_(["completed", "failed"]))
|
||||
.filter(PyPICacheTask.completed_at != None)
|
||||
.order_by(PyPICacheTask.completed_at.desc())
|
||||
.limit(limit)
|
||||
.all()
|
||||
)
|
||||
|
||||
return [
|
||||
{
|
||||
"id": str(task.id),
|
||||
"package": task.package_name,
|
||||
"status": task.status,
|
||||
"type": "pypi",
|
||||
"error": task.error_message if task.status == "failed" else None,
|
||||
"completed_at": task.completed_at.isoformat() if task.completed_at else None,
|
||||
}
|
||||
for task in tasks
|
||||
]
|
||||
|
||||
|
||||
def retry_failed_task(db: Session, package_name: str) -> Optional[PyPICacheTask]:
|
||||
"""
|
||||
Reset a failed task to retry.
|
||||
|
||||
Reference in New Issue
Block a user