Refactor global schedules with mobile-responsive UI and backend optimizations (#167)

* ralph: ralph-global-schedules-dashboard completed after 2 iterations

* Refactor global schedules with mobile-responsive UI and backend optimizations
This commit is contained in:
Chris Scott authored and GitHub committed 2026-03-22 18:23:36 -04:00
1 parent ba15fb31e4
commit f18bcbbf3e
10 files changed
+721 -1

No files matched your search

+37
View File
@@ -373,3 +373,40 @@ export function listScheduleRunsByJob(db: Database, repoId: number, jobId: numbe
const rows = stmt.all(repoId, jobId, limit) as ScheduleRunRow[]
return rows.map(rowToScheduleRun)
}
export interface ScheduleJobWithRepo extends ScheduleJob {
repoName: string
repoPath: string
repoUrl: string
}
interface ScheduleJobWithRepoRow extends ScheduleJobRow {
repo_url: string
repo_path: string
}
function repoNameFromPath(repoPath: string): string {
if (!repoPath || repoPath === '/') return 'Unknown'
return repoPath.split(/[\\/]/).pop() ?? repoPath
}
function rowToScheduleJobWithRepo(row: ScheduleJobWithRepoRow): ScheduleJobWithRepo {
const job = rowToScheduleJob(row)
return {
...job,
repoName: repoNameFromPath(row.repo_path),
repoPath: row.repo_path,
repoUrl: row.repo_url,
}
}
export function listAllScheduleJobsWithRepos(db: Database): ScheduleJobWithRepo[] {
const stmt = db.prepare(`
SELECT sj.*, r.repo_url, r.local_path as repo_path
FROM schedule_jobs sj
JOIN repos r ON sj.repo_id = r.id
ORDER BY r.local_path, sj.name
`)
const rows = stmt.all() as ScheduleJobWithRepoRow[]
return rows.map(rowToScheduleJobWithRepo)
}