Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(385)

Side by Side Diff: milo/appengine/buildbucket/builder.go

Issue 2748073006: Milo Refactor: Remove theme support (Closed)
Patch Set: Review Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 buildbucket 5 package buildbucket
6 6
7 import ( 7 import (
8 "encoding/json" 8 "encoding/json"
9 "fmt" 9 "fmt"
10 "net/url" 10 "net/url"
(...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after
212 target.FinishedBuilds = append(target.FinishedBu ilds, mb) 212 target.FinishedBuilds = append(target.FinishedBu ilds, mb)
213 } 213 }
214 214
215 default: 215 default:
216 panic("impossible") 216 panic("impossible")
217 } 217 }
218 } 218 }
219 return nil 219 return nil
220 } 220 }
221 221
222 type builderQuery struct {
223 Server string
224 Bucket string
225 Builder string
226 Limit int
227 }
228
222 // builderImpl is the implementation for getting a milo builder page from buildb ucket. 229 // builderImpl is the implementation for getting a milo builder page from buildb ucket.
223 // if maxCompletedBuilds < 0, 25 is used. 230 // if maxCompletedBuilds < 0, 25 is used.
224 func builderImpl(c context.Context, server, bucket, builder string, maxCompleted Builds int) (*resp.Builder, error) { 231 func builderImpl(c context.Context, q *builderQuery) (*resp.Builder, error) {
232 » server, bucket, builder, maxCompletedBuilds := q.Server, q.Bucket, q.Bui lder, q.Limit
nodir 2017/03/17 20:47:57 please accept builderQuery instead of *builderQuer
hinoka 2017/03/17 22:04:54 Done.
225 if maxCompletedBuilds < 0 { 233 if maxCompletedBuilds < 0 {
226 maxCompletedBuilds = 20 234 maxCompletedBuilds = 20
227 } 235 }
228 236
229 result := &resp.Builder{ 237 result := &resp.Builder{
230 Name: builder, 238 Name: builder,
231 } 239 }
232 if server == "debug" { 240 if server == "debug" {
233 return result, getDebugBuilds(c, bucket, builder, maxCompletedBu ilds, result) 241 return result, getDebugBuilds(c, bucket, builder, maxCompletedBu ilds, result)
234 } 242 }
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
273 return time.Unix(microseconds/1e6, microseconds%1e6*1000).UTC() 281 return time.Unix(microseconds/1e6, microseconds%1e6*1000).UTC()
274 } 282 }
275 283
276 type newBuildsFirst []*resp.BuildSummary 284 type newBuildsFirst []*resp.BuildSummary
277 285
278 func (a newBuildsFirst) Len() int { return len(a) } 286 func (a newBuildsFirst) Len() int { return len(a) }
279 func (a newBuildsFirst) Swap(i, j int) { a[i], a[j] = a[j], a[i] } 287 func (a newBuildsFirst) Swap(i, j int) { a[i], a[j] = a[j], a[i] }
280 func (a newBuildsFirst) Less(i, j int) bool { 288 func (a newBuildsFirst) Less(i, j int) bool {
281 return a[i].PendingTime.Started.After(a[j].PendingTime.Started) 289 return a[i].PendingTime.Started.After(a[j].PendingTime.Started)
282 } 290 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698