fix filter credential
Signed-off-by: shaowenchen <mail@chenshaowen.com>
This commit is contained in:
@@ -29,6 +29,7 @@ import (
|
||||
"kubesphere.io/kubesphere/pkg/client/informers/externalversions"
|
||||
"kubesphere.io/kubesphere/pkg/models/devops"
|
||||
servererr "kubesphere.io/kubesphere/pkg/server/errors"
|
||||
"kubesphere.io/kubesphere/pkg/server/params"
|
||||
devopsClient "kubesphere.io/kubesphere/pkg/simple/client/devops"
|
||||
)
|
||||
|
||||
@@ -67,8 +68,9 @@ func (h *devopsHandler) GetDevOpsProject(request *restful.Request, response *res
|
||||
|
||||
func (h *devopsHandler) ListDevOpsProject(request *restful.Request, response *restful.Response) {
|
||||
workspace := request.PathParameter("workspace")
|
||||
limit, offset := params.ParsePaging(request)
|
||||
|
||||
projectList, err := h.devops.ListDevOpsProject(workspace)
|
||||
projectList, err := h.devops.ListDevOpsProject(workspace, limit, offset)
|
||||
|
||||
if err != nil {
|
||||
klog.Error(err)
|
||||
@@ -176,8 +178,9 @@ func (h *devopsHandler) GetPipeline(request *restful.Request, response *restful.
|
||||
|
||||
func (h *devopsHandler) ListPipeline(request *restful.Request, response *restful.Response) {
|
||||
devops := request.PathParameter("devops")
|
||||
objs, err := h.devops.ListPipelineObj(devops)
|
||||
limit, offset := params.ParsePaging(request)
|
||||
|
||||
objs, err := h.devops.ListPipelineObj(devops, limit, offset)
|
||||
if err != nil {
|
||||
klog.Error(err)
|
||||
if errors.IsNotFound(err) {
|
||||
@@ -285,8 +288,9 @@ func (h *devopsHandler) GetCredential(request *restful.Request, response *restfu
|
||||
|
||||
func (h *devopsHandler) ListCredential(request *restful.Request, response *restful.Response) {
|
||||
devops := request.PathParameter("devops")
|
||||
limit, offset := params.ParsePaging(request)
|
||||
|
||||
objs, err := h.devops.ListCredentialObj(devops)
|
||||
objs, err := h.devops.ListCredentialObj(devops, limit, offset)
|
||||
|
||||
if err != nil {
|
||||
klog.Error(err)
|
||||
|
||||
@@ -31,6 +31,7 @@ import (
|
||||
kubesphere "kubesphere.io/kubesphere/pkg/client/clientset/versioned"
|
||||
"kubesphere.io/kubesphere/pkg/client/informers/externalversions"
|
||||
"kubesphere.io/kubesphere/pkg/constants"
|
||||
"kubesphere.io/kubesphere/pkg/server/params"
|
||||
devopsClient "kubesphere.io/kubesphere/pkg/simple/client/devops"
|
||||
"net/http"
|
||||
)
|
||||
@@ -54,8 +55,12 @@ func AddToContainer(container *restful.Container, devopsClient devopsClient.Inte
|
||||
ws.Route(ws.GET("/devops/{devops}/credentials").
|
||||
To(handler.ListCredential).
|
||||
Param(ws.PathParameter("devops", "devops name")).
|
||||
Param(ws.QueryParameter(params.PagingParam, "paging query, e.g. limit=100,page=1").
|
||||
Required(false).
|
||||
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, []v1alpha3.PipelineList{}).
|
||||
Returns(http.StatusOK, api.StatusOK, api.ListResult{}).
|
||||
Metadata(restfulspec.KeyOpenAPITags, []string{constants.DevOpsProjectTag}))
|
||||
|
||||
ws.Route(ws.POST("/devops/{devops}/credentials").
|
||||
@@ -95,8 +100,12 @@ func AddToContainer(container *restful.Container, devopsClient devopsClient.Inte
|
||||
ws.Route(ws.GET("/devops/{devops}/pipelines").
|
||||
To(handler.ListPipeline).
|
||||
Param(ws.PathParameter("devops", "devops name")).
|
||||
Param(ws.QueryParameter(params.PagingParam, "paging query, e.g. limit=100,page=1").
|
||||
Required(false).
|
||||
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, []v1alpha3.PipelineList{}).
|
||||
Returns(http.StatusOK, api.StatusOK, api.ListResult{}).
|
||||
Metadata(restfulspec.KeyOpenAPITags, []string{constants.DevOpsProjectTag}))
|
||||
|
||||
ws.Route(ws.POST("/devops/{devops}/pipelines").
|
||||
@@ -134,8 +143,11 @@ func AddToContainer(container *restful.Container, devopsClient devopsClient.Inte
|
||||
ws.Route(ws.GET("/workspaces/{workspace}/devops").
|
||||
To(handler.ListDevOpsProject).
|
||||
Param(ws.PathParameter("workspace", "workspace name")).
|
||||
Doc("List the devopsproject of the specified workspace for the current user").
|
||||
Returns(http.StatusOK, api.StatusOK, []v1alpha3.DevOpsProjectList{}).
|
||||
Param(ws.QueryParameter(params.PagingParam, "paging query, e.g. limit=100,page=1").
|
||||
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{}).
|
||||
Metadata(restfulspec.KeyOpenAPITags, []string{constants.DevOpsProjectTag}))
|
||||
|
||||
ws.Route(ws.POST("/workspaces/{workspace}/devops").
|
||||
|
||||
Reference in New Issue
Block a user