add total num for runs
Signed-off-by: shaowenchen <mail@chenshaowen.com>
This commit is contained in:
@@ -150,6 +150,12 @@ func (p *Pipeline) ListPipelineRuns() (*devops.PipelineRunList, error) {
|
|||||||
klog.Error(err)
|
klog.Error(err)
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
total, err := p.searchPipelineRunsCount()
|
||||||
|
if err != nil {
|
||||||
|
klog.Error(err)
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
pipelineRunList.Total = total
|
||||||
return &pipelineRunList, err
|
return &pipelineRunList, err
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -160,7 +166,7 @@ func (p *Pipeline) searchPipelineRunsCount() (int, error) {
|
|||||||
query.Set("depth", "-1")
|
query.Set("depth", "-1")
|
||||||
//formatUrl := fmt.Sprintf(SearchPipelineRunUrl, projectName, pipelineName)
|
//formatUrl := fmt.Sprintf(SearchPipelineRunUrl, projectName, pipelineName)
|
||||||
|
|
||||||
res, err := p.Jenkins.SendPureRequest(ListPipelineRunUrl+query.Encode(), p.HttpParameters)
|
res, err := p.Jenkins.SendPureRequest(p.Path, p.HttpParameters)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
klog.Error(err)
|
klog.Error(err)
|
||||||
return 0, err
|
return 0, err
|
||||||
|
|||||||
@@ -81,6 +81,7 @@ type Pipeline struct {
|
|||||||
// GetPipeBranchRun & SearchPipelineRuns
|
// GetPipeBranchRun & SearchPipelineRuns
|
||||||
type PipelineRunList struct {
|
type PipelineRunList struct {
|
||||||
Items []PipelineRun `json:"items"`
|
Items []PipelineRun `json:"items"`
|
||||||
|
Total int `json:"totalItems"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// GetBranchPipeRunNodes
|
// GetBranchPipeRunNodes
|
||||||
|
|||||||
Reference in New Issue
Block a user