gateway: add getruns filter by result

This commit is contained in:
Simone Gotti 2019-07-05 10:42:45 +02:00
parent 04ef20464d
commit e7864d0d84
3 changed files with 7 additions and 2 deletions

View File

@ -76,7 +76,7 @@ func runList(cmd *cobra.Command, args []string) error {
return errors.Errorf("failed to get project %s: %v", runListOpts.projectRef, err)
}
groups := []string{path.Join("/project", project.ID)}
runsResp, _, err := gwclient.GetRuns(context.TODO(), runListOpts.phaseFilter, groups, nil, runListOpts.start, runListOpts.limit, false)
runsResp, _, err := gwclient.GetRuns(context.TODO(), runListOpts.phaseFilter, nil, groups, nil, runListOpts.start, runListOpts.limit, false)
if err != nil {
return err
}

View File

@ -338,11 +338,14 @@ func (c *Client) GetRun(ctx context.Context, runID string) (*RunResponse, *http.
return run, resp, err
}
func (c *Client) GetRuns(ctx context.Context, phaseFilter, groups, runGroups []string, start string, limit int, asc bool) ([]*RunsResponse, *http.Response, error) {
func (c *Client) GetRuns(ctx context.Context, phaseFilter, resultFilter, groups, runGroups []string, start string, limit int, asc bool) ([]*RunsResponse, *http.Response, error) {
q := url.Values{}
for _, phase := range phaseFilter {
q.Add("phase", phase)
}
for _, result := range resultFilter {
q.Add("result", result)
}
for _, group := range groups {
q.Add("group", group)
}

View File

@ -324,6 +324,7 @@ func (h *RunsHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
}
phaseFilter := q["phase"]
resultFilter := q["result"]
changeGroups := q["changegroup"]
_, lastRun := q["lastrun"]
@ -353,6 +354,7 @@ func (h *RunsHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
areq := &action.GetRunsRequest{
PhaseFilter: phaseFilter,
ResultFilter: resultFilter,
Group: group,
LastRun: lastRun,
ChangeGroups: changeGroups,