Skip to content

Commit

Permalink
Provide filter query by job displayName, add disabled pristine jobs r…
Browse files Browse the repository at this point in the history
…eports
  • Loading branch information
Miguel Sousa authored and Miguel Sousa committed Mar 15, 2021
1 parent b6b593a commit d1c3184
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 10 deletions.
2 changes: 1 addition & 1 deletion dkron/store.go
Original file line number Diff line number Diff line change
Expand Up @@ -716,4 +716,4 @@ func trimDirectoryKey(key []byte) []byte {

func isDirectoryKey(key []byte) bool {
return len(key) > 0 && key[len(key)-1] == ':'
}
}
22 changes: 13 additions & 9 deletions dkron/ui.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,14 +40,17 @@ func (h *HTTPTransport) UI(r *gin.RouterGroup) {
if err != nil {
log.Error(err)
}
totalJobs := len(jobs)
successfulJobs := 0
failedJobs := 0
var (
totalJobs = len(jobs)
successfulJobs, failedJobs, pristineJobs int
)
for _, j := range jobs {
if j.Status == "success" {
successfulJobs++
} else {
} else if j.Status == "failed" {
failedJobs++
} else {
pristineJobs++
}
}
l, err := h.agent.leaderMember()
Expand All @@ -58,11 +61,12 @@ func (h *HTTPTransport) UI(r *gin.RouterGroup) {
ln = l.Name
}
ctx.HTML(http.StatusOK, "index.html", gin.H{
"DKRON_API_URL": fmt.Sprintf("/%s", apiPathPrefix),
"DKRON_LEADER": ln,
"DKRON_TOTAL_JOBS": totalJobs,
"DKRON_FAILED_JOBS": failedJobs,
"DKRON_SUCCESSFUL_JOBS": successfulJobs,
"DKRON_API_URL": fmt.Sprintf("/%s", apiPathPrefix),
"DKRON_LEADER": ln,
"DKRON_TOTAL_JOBS": totalJobs,
"DKRON_FAILED_JOBS": failedJobs,
"DKRON_DIS_PRISTINE_JOBS": pristineJobs,
"DKRON_SUCCESSFUL_JOBS": successfulJobs,
})
}
})
Expand Down

0 comments on commit d1c3184

Please sign in to comment.