mirror of
https://github.com/onepanelio/onepanel.git
synced 2025-10-05 13:46:51 +08:00
add ListWorkflowTemplateVersions
This commit is contained in:
@@ -73,3 +73,25 @@ func (s *WorkflowServer) GetWorkflowTemplate(ctx context.Context, req *api.GetWo
|
||||
Manifest: workflowTemplate.Manifest,
|
||||
}, nil
|
||||
}
|
||||
|
||||
func (s *WorkflowServer) ListWorkflowTemplateVersions(ctx context.Context, req *api.ListWorkflowTemplateVersionsRequest) (*api.ListWorkflowTemplateVersionsResponse, error) {
|
||||
workflowTemplateVersions, err := s.resourceManager.ListWorkflowTemplateVersions(req.Namespace, req.Uid)
|
||||
if errors.As(err, &userError) {
|
||||
return nil, userError.GRPCError()
|
||||
}
|
||||
|
||||
workflowTemplates := []*api.WorkflowTemplate{}
|
||||
for _, wtv := range workflowTemplateVersions {
|
||||
workflowTemplates = append(workflowTemplates, &api.WorkflowTemplate{
|
||||
Uid: wtv.UID,
|
||||
Name: wtv.Name,
|
||||
Version: wtv.Version.String(),
|
||||
Manifest: wtv.Manifest,
|
||||
})
|
||||
}
|
||||
|
||||
return &api.ListWorkflowTemplateVersionsResponse{
|
||||
Count: int32(len(workflowTemplateVersions)),
|
||||
WorkflowTemplates: workflowTemplates,
|
||||
}, nil
|
||||
}
|
||||
|
Reference in New Issue
Block a user