Skip to content

Commit

Permalink
Show job tooltips with info
Browse files Browse the repository at this point in the history
  • Loading branch information
Victor Castell committed Nov 19, 2015
1 parent caa9a2a commit 9d8a563
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 1 deletion.
5 changes: 5 additions & 0 deletions dkron/dashboard.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package dkron

import (
"encoding/json"
"fmt"
"html/template"
"net/http"
Expand Down Expand Up @@ -102,6 +103,10 @@ func (a *AgentCommand) dashboardJobsHandler(w http.ResponseWriter, r *http.Reque

return ""
},
"jobJson": func(job *Job) string {
j, _ := json.MarshalIndent(job, "", "<br>")
return string(j)
},
}

tmpl := template.Must(template.New("dashboard.html.tmpl").Funcs(funcs).ParseFiles(
Expand Down
3 changes: 3 additions & 0 deletions templates/dashboard.html.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@

<script>
var DKRON_API_PATH = "{{ .Common.APIPath }}";
$(function () {
$('[data-toggle="tooltip"]').tooltip()
})
</script>
</head>

Expand Down
3 changes: 2 additions & 1 deletion templates/jobs.html.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@
</tr>
{{ range $job := .Jobs }}
<tr>
<td><a href="jobs/{{$job.Name}}/executions">{{ $job.Name }}</a></td>

<td><a href="jobs/{{$job.Name}}/executions" data-toggle="tooltip" data-placement="top" title="{{ jobJson $job }}" data-html="true">{{ $job.Name }}</a></td>
<td>{{ $job.SuccessCount }}</td>
<td>{{ $job.ErrorCount }}</td>
<td>
Expand Down

0 comments on commit 9d8a563

Please sign in to comment.