dashboard/app: do not send unnecessary data in todo response

R=adg
CC=golang-dev
https://golang.org/cl/30350043
This commit is contained in:
Dmitriy Vyukov 2013-11-25 10:15:56 +04:00
parent 397114a391
commit 23d25a2ed7
2 changed files with 11 additions and 7 deletions

View File

@ -188,7 +188,7 @@ func partsToHash(c *Commit, p []string) *Result {
// A Result describes a build result for a Commit on an OS/architecture. // A Result describes a build result for a Commit on an OS/architecture.
// //
// Each Result entity is a descendant of its associated Commit entity. // Each Result entity is a descendant of its associated Package entity.
type Result struct { type Result struct {
Builder string // "os-arch[-note]" Builder string // "os-arch[-note]"
Hash string Hash string

View File

@ -158,17 +158,21 @@ func todoHandler(r *http.Request) (interface{}, error) {
var err error var err error
builder := r.FormValue("builder") builder := r.FormValue("builder")
for _, kind := range r.Form["kind"] { for _, kind := range r.Form["kind"] {
var data interface{} var com *Commit
switch kind { switch kind {
case "build-go-commit": case "build-go-commit":
data, err = buildTodo(c, builder, "", "") com, err = buildTodo(c, builder, "", "")
case "build-package": case "build-package":
packagePath := r.FormValue("packagePath") packagePath := r.FormValue("packagePath")
goHash := r.FormValue("goHash") goHash := r.FormValue("goHash")
data, err = buildTodo(c, builder, packagePath, goHash) com, err = buildTodo(c, builder, packagePath, goHash)
} }
if data != nil || err != nil { if com != nil || err != nil {
todo = &Todo{Kind: kind, Data: data} if com != nil {
// ResultData can be large and not needed on builder.
com.ResultData = []string{}
}
todo = &Todo{Kind: kind, Data: com}
break break
} }
} }
@ -187,7 +191,7 @@ func todoHandler(r *http.Request) (interface{}, error) {
// If provided with non-empty packagePath and goHash args, it scans the first // If provided with non-empty packagePath and goHash args, it scans the first
// 20 Commits in Num-descending order for the specified packagePath and // 20 Commits in Num-descending order for the specified packagePath and
// returns the first that doesn't have a Result for this builder and goHash. // returns the first that doesn't have a Result for this builder and goHash.
func buildTodo(c appengine.Context, builder, packagePath, goHash string) (interface{}, error) { func buildTodo(c appengine.Context, builder, packagePath, goHash string) (*Commit, error) {
p, err := GetPackage(c, packagePath) p, err := GetPackage(c, packagePath)
if err != nil { if err != nil {
return nil, err return nil, err