workflow list logic

This commit is contained in:
rushtehrani
2019-12-16 10:57:38 -08:00
parent e933edeff5
commit 3487fd3367
6 changed files with 74 additions and 48 deletions

View File

@@ -81,7 +81,20 @@ func (s *WorkflowServer) GetWorkflow(ctx context.Context, req *api.GetWorkflowRe
}
func (s *WorkflowServer) ListWorkflows(ctx context.Context, req *api.ListWorkflowsRequest) (*api.ListWorkflowsResponse, error) {
return nil, nil
workflows, err := s.resourceManager.ListWorkflows(req.Namespace, req.WorkflowTemplateUid)
if errors.As(err, &userError) {
return nil, userError.GRPCError()
}
apiWorkflows := []*api.Workflow{}
for _, wf := range workflows {
apiWorkflows = append(apiWorkflows, apiWorkflow(wf))
}
return &api.ListWorkflowsResponse{
Count: int32(len(apiWorkflows)),
Workflows: apiWorkflows,
}, nil
}
func (s *WorkflowServer) CreateWorkflowTemplate(ctx context.Context, req *api.CreateWorkflowTemplateRequest) (*api.WorkflowTemplate, error) {