| OLD | NEW |
| 1 // Copyright 2016 The LUCI Authors. All rights reserved. | 1 // Copyright 2016 The LUCI Authors. All rights reserved. |
| 2 // Use of this source code is governed under the Apache License, Version 2.0 | 2 // Use of this source code is governed under the Apache License, Version 2.0 |
| 3 // that can be found in the LICENSE file. | 3 // that can be found in the LICENSE file. |
| 4 | 4 |
| 5 package buildbot | 5 package buildbot |
| 6 | 6 |
| 7 import ( | 7 import ( |
| 8 "fmt" | 8 "fmt" |
| 9 "net/http" | 9 "net/http" |
| 10 "sort" | 10 "sort" |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 71 if err != nil { | 71 if err != nil { |
| 72 return nil, err | 72 return nil, err |
| 73 } | 73 } |
| 74 for _, b := range buildbots { | 74 for _, b := range buildbots { |
| 75 result = append(result, getBuildSummary(b)) | 75 result = append(result, getBuildSummary(b)) |
| 76 } | 76 } |
| 77 return result, nil | 77 return result, nil |
| 78 } | 78 } |
| 79 | 79 |
| 80 var errMasterNotFound = miloerror.Error{ | 80 var errMasterNotFound = miloerror.Error{ |
| 81 » Message: "Master not found", | 81 » Message: "Either the request resource was not found or you are not autho
rized", |
| 82 Code: http.StatusNotFound, | 82 Code: http.StatusNotFound, |
| 83 } | 83 } |
| 84 | 84 |
| 85 var errNotAuth = miloerror.Error{ |
| 86 Message: "You are not authenticated, try logging in", |
| 87 Code: http.StatusUnauthorized, |
| 88 } |
| 89 |
| 85 // builderImpl is the implementation for getting a milo builder page from buildb
ot. | 90 // builderImpl is the implementation for getting a milo builder page from buildb
ot. |
| 86 // This gets: | 91 // This gets: |
| 87 // * Current Builds from querying the master json from the datastore. | 92 // * Current Builds from querying the master json from the datastore. |
| 88 // * Recent Builds from a cron job that backfills the recent builds. | 93 // * Recent Builds from a cron job that backfills the recent builds. |
| 89 func builderImpl(c context.Context, masterName, builderName string, limit int) (
*resp.Builder, error) { | 94 func builderImpl(c context.Context, masterName, builderName string, limit int) (
*resp.Builder, error) { |
| 90 result := &resp.Builder{ | 95 result := &resp.Builder{ |
| 91 Name: builderName, | 96 Name: builderName, |
| 92 } | 97 } |
| 93 master, t, err := getMasterJSON(c, masterName) | 98 master, t, err := getMasterJSON(c, masterName) |
| 94 if err != nil { | 99 if err != nil { |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 150 } | 155 } |
| 151 result.CurrentBuilds = currentBuilds | 156 result.CurrentBuilds = currentBuilds |
| 152 | 157 |
| 153 for _, fb := range finishedBuilds { | 158 for _, fb := range finishedBuilds { |
| 154 if fb != nil { | 159 if fb != nil { |
| 155 result.FinishedBuilds = append(result.FinishedBuilds, fb
) | 160 result.FinishedBuilds = append(result.FinishedBuilds, fb
) |
| 156 } | 161 } |
| 157 } | 162 } |
| 158 return result, nil | 163 return result, nil |
| 159 } | 164 } |
| OLD | NEW |