TaskOutputHttpHandler Http Handler for output task info
(w http.ResponseWriter, r *http.Request)
| 28 | |
| 29 | // TaskOutputHttpHandler Http Handler for output task info |
| 30 | func (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 | |
| 55 | func createOneTableHtml(col, title, header, body string) string { |
| 56 | template := `<br><table class="bordered"> |
nothing calls this directly
no test coverage detected