| 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 apiservers | 5 package apiservers |
| 6 | 6 |
| 7 import ( | 7 import ( |
| 8 "github.com/luci/luci-go/scheduler/api/scheduler/v1" | 8 "github.com/luci/luci-go/scheduler/api/scheduler/v1" |
| 9 "github.com/luci/luci-go/scheduler/appengine/catalog" | 9 "github.com/luci/luci-go/scheduler/appengine/catalog" |
| 10 "github.com/luci/luci-go/scheduler/appengine/engine" | 10 "github.com/luci/luci-go/scheduler/appengine/engine" |
| (...skipping 24 matching lines...) Expand all Loading... |
| 35 return nil, grpc.Errorf(codes.Internal, "datastore error: %s", e
rr) | 35 return nil, grpc.Errorf(codes.Internal, "datastore error: %s", e
rr) |
| 36 } | 36 } |
| 37 | 37 |
| 38 jobs := make([]*scheduler.Job, len(ejobs)) | 38 jobs := make([]*scheduler.Job, len(ejobs)) |
| 39 for i, ej := range ejobs { | 39 for i, ej := range ejobs { |
| 40 traits, err := presentation.GetJobTraits(ctx, s.Catalog, ej) | 40 traits, err := presentation.GetJobTraits(ctx, s.Catalog, ej) |
| 41 if err != nil { | 41 if err != nil { |
| 42 return nil, grpc.Errorf(codes.Internal, "failed to get t
raits: %s", err) | 42 return nil, grpc.Errorf(codes.Internal, "failed to get t
raits: %s", err) |
| 43 } | 43 } |
| 44 jobs[i] = &scheduler.Job{ | 44 jobs[i] = &scheduler.Job{ |
| 45 » » » Id: ej.JobID, | 45 » » » Name: ej.GetJobName(), |
| 46 Project: ej.ProjectID, | 46 Project: ej.ProjectID, |
| 47 Schedule: ej.Schedule, | 47 Schedule: ej.Schedule, |
| 48 State: &scheduler.JobState{ | 48 State: &scheduler.JobState{ |
| 49 UiStatus: string(presentation.GetPublicStateKind
(ej, traits)), | 49 UiStatus: string(presentation.GetPublicStateKind
(ej, traits)), |
| 50 }, | 50 }, |
| 51 } | 51 } |
| 52 } | 52 } |
| 53 return &scheduler.JobsReply{Jobs: jobs}, nil | 53 return &scheduler.JobsReply{Jobs: jobs}, nil |
| 54 } | 54 } |
| OLD | NEW |