pipeline dag visualization + Dashboard command center upgrade + command palette wiring. fixed repo pipeline page.

This commit is contained in:
2026-05-11 20:49:48 +02:00
parent 3838aa1f53
commit 4f2fb846dd
15 changed files with 1659 additions and 203 deletions
+46
View File
@@ -61,12 +61,27 @@ type dashRepo struct {
OpenIssueCount int `json:"openIssueCount"`
}
type dashRun struct {
ID int64 `json:"id"`
RepoID int64 `json:"repoId"`
RepoName string `json:"repoName"`
OwnerName string `json:"ownerName"`
TriggerRef string `json:"triggerRef"`
TriggerSHA string `json:"triggerSha"`
TriggeredBy string `json:"triggeredBy"`
Status string `json:"status"`
StartedAt *string `json:"startedAt"`
FinishedAt *string `json:"finishedAt"`
CreatedAt string `json:"createdAt"`
}
type dashboardResponse struct {
Stats dashStats `json:"stats"`
ReviewQueue []dashPR `json:"reviewQueue"`
MyOpenPRs []dashPR `json:"myOpenPRs"`
MyOpenIssues []dashIssue `json:"myOpenIssues"`
Repos []dashRepo `json:"repos"`
RecentRuns []dashRun `json:"recentRuns"`
}
// ── Handler ───────────────────────────────────────────────────────────────────
@@ -211,6 +226,36 @@ func (h *DashboardHandler) Get(w http.ResponseWriter, r *http.Request) {
})
}
// 7. Recent CI runs across user repos.
var recentRuns []models.PipelineRun
if len(repoIDs) > 0 {
h.db.In("repo_id", repoIDs).Desc("id").Limit(5).Find(&recentRuns)
}
runsDash := make([]dashRun, 0, len(recentRuns))
for _, run := range recentRuns {
rp := repoByID[run.RepoID]
dr := dashRun{
ID: run.ID,
RepoID: run.RepoID,
RepoName: rp.Name,
OwnerName: owner.Username,
TriggerRef: run.TriggerRef,
TriggerSHA: run.TriggerSHA,
TriggeredBy: run.TriggeredBy,
Status: run.Status,
CreatedAt: run.CreatedAt.Format("2006-01-02T15:04:05Z"),
}
if run.StartedAt != nil {
s := run.StartedAt.Format("2006-01-02T15:04:05Z")
dr.StartedAt = &s
}
if run.FinishedAt != nil {
f := run.FinishedAt.Format("2006-01-02T15:04:05Z")
dr.FinishedAt = &f
}
runsDash = append(runsDash, dr)
}
resp := dashboardResponse{
Stats: dashStats{
RepoCount: len(repos),
@@ -222,6 +267,7 @@ func (h *DashboardHandler) Get(w http.ResponseWriter, r *http.Request) {
MyOpenPRs: myPRDash,
MyOpenIssues: issueDash,
Repos: dashRepos,
RecentRuns: runsDash,
}
jsonOK(w, resp)
}