MCPcopy Create free account
hub / github.com/devfeel/dottask / TaskOutputHttpHandler

Method TaskOutputHttpHandler

tasks_httphandler.go:30–53  ·  view source on GitHub ↗

TaskOutputHttpHandler Http Handler for output task info

(w http.ResponseWriter, r *http.Request)

Source from the content-addressed store, hash-verified

28
29// TaskOutputHttpHandler Http Handler for output task info
30func (service *TaskService) TaskOutputHttpHandler(w http.ResponseWriter, r *http.Request) {
31 tableData := ""
32 for _, v := range service.GetAllTasks() {
33 tableData += "<tr><td>" + v.TaskID() + "</td><td>" + v.GetConfig().TaskType + "</td><td>" + fmt.Sprint(v.GetConfig().IsRun) + "</td><td>" + v.GetConfig().Express + "</td><td>" + fmt.Sprint(v.GetConfig().DueTime) + "</td><td>" + fmt.Sprint(v.GetConfig().Interval) + "</td></tr>"
34 }
35 col := `<colgroup>
36 <col width="20%">
37 <col width="10%">
38 <col width="10%">
39 <col width="30%">
40 <col width="15%">
41 <col width="15%">
42 </colgroup>`
43 header := `<tr>
44 <th>TaskID</th>
45 <th>TaskType</th>
46 <th>IsRun</th>
47 <th>Express</th>
48 <th>DueTime</th>
49 <th>Interval</th>
50 </tr>`
51 html := createOneTableHtml(col, "TaskInfo", header, tableData)
52 w.Write([]byte(html))
53}
54
55func createOneTableHtml(col, title, header, body string) string {
56 template := `<br><table class="bordered">

Callers

nothing calls this directly

Calls 4

GetAllTasksMethod · 0.95
createOneTableHtmlFunction · 0.85
TaskIDMethod · 0.65
GetConfigMethod · 0.65

Tested by

no test coverage detected