feat: added support for filtering workflow templates by a single label.

When a workflow template is created, or a new version is created, we now stores the labels for it as the latest labels. This makes it easier to filter based on labels.
This commit is contained in:
Andrey Melnikov
2020-07-28 16:57:43 -07:00
parent 5009a2643f
commit da8cb2859a
3 changed files with 43 additions and 8 deletions

View File

@@ -98,6 +98,10 @@ func (s *WorkflowTemplateServer) CreateWorkflowTemplateVersion(ctx context.Conte
return nil, err
}
if err := client.ReplaceLabelsUsingKnownID(req.Namespace, v1.TypeWorkflowTemplate, workflowTemplate.ID, workflowTemplate.UID, workflowTemplate.Labels); err != nil {
return nil, err
}
req.WorkflowTemplate.Uid = workflowTemplate.UID
req.WorkflowTemplate.Name = workflowTemplate.Name
req.WorkflowTemplate.Version = workflowTemplate.Version
@@ -213,7 +217,7 @@ func (s *WorkflowTemplateServer) ListWorkflowTemplates(ctx context.Context, req
apiWorkflowTemplates = append(apiWorkflowTemplates, apiWorkflowTemplate(wtv))
}
count, err := client.CountWorkflowTemplates(req.Namespace)
count, err := client.CountWorkflowTemplates(req.Namespace, &filter)
if err != nil {
return nil, err
}