mirror of
https://github.com/chriswritescode-dev/opencode-manager.git
synced 2026-12-05 20:34:18 +01:00
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:
1 parent
ba15fb31e4
commit
f18bcbbf3e
10 files changed
+721
-1
No files matched your search
@@ -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)
|
||||
}
|
||||
Reference in new issue
Block a user