@@ -60,7 +60,7 @@ func AddToContainer(container *restful.Container, devopsClient devopsClient.Inte
|
||||
DataFormat("limit=%d,page=%d").
|
||||
DefaultValue("limit=10,page=1")).
|
||||
Doc("list the credentials of the specified devops for the current user").
|
||||
Returns(http.StatusOK, api.StatusOK, api.ListResult{}).
|
||||
Returns(http.StatusOK, api.StatusOK, api.ListResult{Items: []interface{}{}}).
|
||||
Metadata(restfulspec.KeyOpenAPITags, []string{constants.DevOpsProjectTag}))
|
||||
|
||||
ws.Route(ws.POST("/devops/{devops}/credentials").
|
||||
@@ -105,7 +105,7 @@ func AddToContainer(container *restful.Container, devopsClient devopsClient.Inte
|
||||
DataFormat("limit=%d,page=%d").
|
||||
DefaultValue("limit=10,page=1")).
|
||||
Doc("list the pipelines of the specified devops for the current user").
|
||||
Returns(http.StatusOK, api.StatusOK, api.ListResult{}).
|
||||
Returns(http.StatusOK, api.StatusOK, api.ListResult{Items: []interface{}{}}).
|
||||
Metadata(restfulspec.KeyOpenAPITags, []string{constants.DevOpsProjectTag}))
|
||||
|
||||
ws.Route(ws.POST("/devops/{devops}/pipelines").
|
||||
@@ -147,7 +147,7 @@ func AddToContainer(container *restful.Container, devopsClient devopsClient.Inte
|
||||
Required(false).
|
||||
DataFormat("limit=%d,page=%d").
|
||||
DefaultValue("limit=10,page=1")).Doc("List the devopsproject of the specified workspace for the current user").
|
||||
Returns(http.StatusOK, api.StatusOK, api.ListResult{}).
|
||||
Returns(http.StatusOK, api.StatusOK, api.ListResult{Items: []interface{}{}}).
|
||||
Metadata(restfulspec.KeyOpenAPITags, []string{constants.DevOpsProjectTag}))
|
||||
|
||||
ws.Route(ws.POST("/workspaces/{workspace}/devops").
|
||||
|
||||
@@ -175,6 +175,9 @@ func (d devopsOperator) ListDevOpsProject(workspace string, limit, offset int) (
|
||||
limit = len(result) - offset
|
||||
}
|
||||
items = result[offset : offset+limit]
|
||||
if items == nil {
|
||||
items = []interface{}{}
|
||||
}
|
||||
return api.ListResult{TotalItems: len(result), Items: items}, nil
|
||||
}
|
||||
|
||||
@@ -218,7 +221,7 @@ func (d devopsOperator) ListPipelineObj(projectName string, limit, offset int) (
|
||||
}
|
||||
data, err := d.ksInformers.Devops().V1alpha3().Pipelines().Lister().Pipelines(projectObj.Status.AdminNamespace).List(labels.Everything())
|
||||
if err != nil {
|
||||
return api.ListResult{}, nil
|
||||
return api.ListResult{}, err
|
||||
}
|
||||
items := make([]interface{}, 0)
|
||||
var result []interface{}
|
||||
@@ -230,6 +233,9 @@ func (d devopsOperator) ListPipelineObj(projectName string, limit, offset int) (
|
||||
limit = len(result) - offset
|
||||
}
|
||||
items = result[offset : offset+limit]
|
||||
if items == nil {
|
||||
items = []interface{}{}
|
||||
}
|
||||
return api.ListResult{TotalItems: len(result), Items: items}, nil
|
||||
}
|
||||
|
||||
@@ -298,6 +304,9 @@ func (d devopsOperator) ListCredentialObj(projectName string, limit, offset int)
|
||||
limit = len(result) - offset
|
||||
}
|
||||
items = result[offset : offset+limit]
|
||||
if items == nil {
|
||||
items = []interface{}{}
|
||||
}
|
||||
return api.ListResult{TotalItems: len(result), Items: items}, nil
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user