mirror of
https://github.com/onepanelio/onepanel.git
synced 2025-10-05 13:46:51 +08:00
feat: added versions to workflow tempaltes.
update: updated logic to get workflow template executions stats to be a single query.
This commit is contained in:
@@ -2253,6 +2253,10 @@
|
|||||||
"type": "integer",
|
"type": "integer",
|
||||||
"format": "int32"
|
"format": "int32"
|
||||||
},
|
},
|
||||||
|
"versions": {
|
||||||
|
"type": "integer",
|
||||||
|
"format": "int32"
|
||||||
|
},
|
||||||
"manifest": {
|
"manifest": {
|
||||||
"type": "string"
|
"type": "string"
|
||||||
},
|
},
|
||||||
|
@@ -579,11 +579,12 @@ type WorkflowTemplate struct {
|
|||||||
Uid string `protobuf:"bytes,2,opt,name=uid,proto3" json:"uid,omitempty"`
|
Uid string `protobuf:"bytes,2,opt,name=uid,proto3" json:"uid,omitempty"`
|
||||||
Name string `protobuf:"bytes,3,opt,name=name,proto3" json:"name,omitempty"`
|
Name string `protobuf:"bytes,3,opt,name=name,proto3" json:"name,omitempty"`
|
||||||
Version int32 `protobuf:"varint,4,opt,name=version,proto3" json:"version,omitempty"`
|
Version int32 `protobuf:"varint,4,opt,name=version,proto3" json:"version,omitempty"`
|
||||||
Manifest string `protobuf:"bytes,5,opt,name=manifest,proto3" json:"manifest,omitempty"`
|
Versions int32 `protobuf:"varint,5,opt,name=versions,proto3" json:"versions,omitempty"`
|
||||||
IsLatest bool `protobuf:"varint,6,opt,name=isLatest,proto3" json:"isLatest,omitempty"`
|
Manifest string `protobuf:"bytes,6,opt,name=manifest,proto3" json:"manifest,omitempty"`
|
||||||
IsArchived bool `protobuf:"varint,7,opt,name=isArchived,proto3" json:"isArchived,omitempty"`
|
IsLatest bool `protobuf:"varint,7,opt,name=isLatest,proto3" json:"isLatest,omitempty"`
|
||||||
Labels []*KeyValue `protobuf:"bytes,8,rep,name=labels,proto3" json:"labels,omitempty"`
|
IsArchived bool `protobuf:"varint,8,opt,name=isArchived,proto3" json:"isArchived,omitempty"`
|
||||||
Stats *WorkflowExecutionStatisticReport `protobuf:"bytes,9,opt,name=stats,proto3" json:"stats,omitempty"`
|
Labels []*KeyValue `protobuf:"bytes,9,rep,name=labels,proto3" json:"labels,omitempty"`
|
||||||
|
Stats *WorkflowExecutionStatisticReport `protobuf:"bytes,10,opt,name=stats,proto3" json:"stats,omitempty"`
|
||||||
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
||||||
XXX_unrecognized []byte `json:"-"`
|
XXX_unrecognized []byte `json:"-"`
|
||||||
XXX_sizecache int32 `json:"-"`
|
XXX_sizecache int32 `json:"-"`
|
||||||
@@ -642,6 +643,13 @@ func (m *WorkflowTemplate) GetVersion() int32 {
|
|||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (m *WorkflowTemplate) GetVersions() int32 {
|
||||||
|
if m != nil {
|
||||||
|
return m.Versions
|
||||||
|
}
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
func (m *WorkflowTemplate) GetManifest() string {
|
func (m *WorkflowTemplate) GetManifest() string {
|
||||||
if m != nil {
|
if m != nil {
|
||||||
return m.Manifest
|
return m.Manifest
|
||||||
@@ -759,68 +767,69 @@ func init() {
|
|||||||
func init() { proto.RegisterFile("workflow_template.proto", fileDescriptor_b9a07547748a96e8) }
|
func init() { proto.RegisterFile("workflow_template.proto", fileDescriptor_b9a07547748a96e8) }
|
||||||
|
|
||||||
var fileDescriptor_b9a07547748a96e8 = []byte{
|
var fileDescriptor_b9a07547748a96e8 = []byte{
|
||||||
// 975 bytes of a gzipped FileDescriptorProto
|
// 984 bytes of a gzipped FileDescriptorProto
|
||||||
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xbc, 0x97, 0x4f, 0x6f, 0x1b, 0x45,
|
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xbc, 0x97, 0x4f, 0x6f, 0x1b, 0x45,
|
||||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,
|
0x99, 0x37, 0x6f, 0x7e, 0xef, 0xcf, 0xcc, 0x7b, 0x0b, 0x2b, 0x47, 0x61, 0xfb, 0x61, 0xcb, 0x0f,
|
||||||
0x3e, 0x56, 0xfc, 0x20, 0xf2, 0x99, 0xe2, 0xf5, 0xa8, 0x1d, 0xaa, 0x10, 0xe7, 0x58, 0x24, 0xec,
|
0x8f, 0x3e, 0x54, 0xfc, 0x20, 0xf2, 0x99, 0xe2, 0xf5, 0xa8, 0x1d, 0xaa, 0x10, 0xe7, 0x58, 0x24,
|
||||||
0xb5, 0xfd, 0x30, 0xdc, 0xf7, 0x79, 0x83, 0x45, 0xa2, 0xc1, 0x82, 0x20, 0x54, 0x4c, 0x89, 0x30,
|
0xec, 0xb5, 0xfd, 0x30, 0xdc, 0xf7, 0x79, 0x83, 0x45, 0xa2, 0xc1, 0x82, 0x20, 0x54, 0x4c, 0x89,
|
||||||
0x90, 0x89, 0x88, 0x7d, 0xce, 0x67, 0x7b, 0xdc, 0x4f, 0x16, 0xf4, 0x2b, 0x02, 0xeb, 0x3b, 0x6d,
|
0x30, 0x90, 0x89, 0x88, 0x7d, 0xce, 0x67, 0x7b, 0xdc, 0x4f, 0x06, 0xf4, 0x0b, 0x02, 0xeb, 0x3b,
|
||||||
0xce, 0x14, 0xff, 0x28, 0xd5, 0xf8, 0x61, 0xaa, 0xd0, 0xe1, 0x9f, 0x75, 0xb8, 0x54, 0xb8, 0x06,
|
0x6d, 0xce, 0x14, 0xff, 0x20, 0xd5, 0xf8, 0x7e, 0xaa, 0xd0, 0xe1, 0x9f, 0x74, 0xb8, 0x54, 0xb8,
|
||||||
0x95, 0x80, 0x1d, 0x70, 0x19, 0x31, 0x97, 0x5b, 0xa4, 0x4a, 0x6a, 0x15, 0xe7, 0x64, 0x03, 0x9b,
|
0x06, 0x95, 0x80, 0x1d, 0x70, 0x19, 0x31, 0x97, 0x5b, 0xa4, 0x4a, 0x6a, 0x15, 0xe7, 0x64, 0x02,
|
||||||
0xb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
|
||||||
0xe9, 0x14, 0x40, 0xdb, 0xd9, 0x28, 0xf1, 0x84, 0xc0, 0xba, 0xc3, 0x23, 0x9f, 0xb9, 0xdc, 0x00,
|
0x68, 0x7a, 0xde, 0x78, 0x40, 0xef, 0x6a, 0xa0, 0x9b, 0x74, 0x0a, 0xa0, 0xed, 0xac, 0x95, 0x78,
|
||||||
0xb7, 0xaa, 0x29, 0x52, 0x99, 0x42, 0x80, 0xf6, 0x2c, 0x00, 0x7f, 0x26, 0xf0, 0xca, 0x4d, 0x1e,
|
0x42, 0x60, 0xdd, 0xe1, 0x91, 0xcf, 0x5c, 0x6e, 0x80, 0x5b, 0xd5, 0x14, 0xa9, 0x4c, 0x21, 0x40,
|
||||||
0x4f, 0x80, 0xb9, 0x7c, 0xb8, 0xa2, 0x19, 0x12, 0x09, 0xbd, 0xf3, 0x5f, 0x70, 0xef, 0x6a, 0xb8,
|
0x7b, 0x16, 0x80, 0x3f, 0x12, 0x78, 0xe9, 0x26, 0x8f, 0xbb, 0xc3, 0x5c, 0x3e, 0x5c, 0xd1, 0x0c,
|
||||||
0x1b, 0xaf, 0x5d, 0x9f, 0x1c, 0xae, 0x71, 0xfc, 0x90, 0x3f, 0xea, 0xee, 0xcd, 0xeb, 0xbf, 0xdb,
|
0x89, 0x84, 0x9e, 0xf9, 0x2f, 0xb8, 0xb7, 0x35, 0xdc, 0x8d, 0x57, 0xae, 0x4f, 0x0e, 0xd7, 0x38,
|
||||||
0x6f, 0xfc, 0x1b, 0x00, 0x00, 0xff, 0xff, 0xeb, 0xe1, 0x8a, 0xe9, 0xb9, 0x0f, 0x00, 0x00,
|
0x7e, 0xc8, 0x1f, 0x75, 0xf7, 0xe6, 0xf5, 0xaf, 0xf8, 0x6b, 0xff, 0x06, 0x00, 0x00, 0xff, 0xff,
|
||||||
|
0xdf, 0xf3, 0x87, 0x10, 0xd5, 0x0f, 0x00, 0x00,
|
||||||
}
|
}
|
||||||
|
|
||||||
// Reference imports to suppress errors if they are not otherwise used.
|
// Reference imports to suppress errors if they are not otherwise used.
|
||||||
|
@@ -154,12 +154,13 @@ message WorkflowTemplate {
|
|||||||
string uid = 2;
|
string uid = 2;
|
||||||
string name = 3;
|
string name = 3;
|
||||||
int32 version = 4;
|
int32 version = 4;
|
||||||
string manifest = 5;
|
int32 versions = 5;
|
||||||
bool isLatest = 6;
|
string manifest = 6;
|
||||||
bool isArchived = 7;
|
bool isLatest = 7;
|
||||||
repeated KeyValue labels = 8;
|
bool isArchived = 8;
|
||||||
|
repeated KeyValue labels = 9;
|
||||||
|
|
||||||
WorkflowExecutionStatisticReport stats = 9;
|
WorkflowExecutionStatisticReport stats = 10;
|
||||||
}
|
}
|
||||||
|
|
||||||
message GetWorkflowTemplateLabelsRequest {
|
message GetWorkflowTemplateLabelsRequest {
|
||||||
|
@@ -0,0 +1,7 @@
|
|||||||
|
-- +goose Up
|
||||||
|
ALTER TABLE workflow_templates ADD COLUMN versions INTEGER;
|
||||||
|
UPDATE workflow_templates SET versions = 1;
|
||||||
|
ALTER TABLE workflow_templates ALTER COLUMN versions SET NOT NULL;
|
||||||
|
|
||||||
|
-- +goose Down
|
||||||
|
ALTER TABLE workflow_templates DROP COLUMN versions;
|
12
pkg/types.go
12
pkg/types.go
@@ -62,6 +62,7 @@ type WorkflowTemplate struct {
|
|||||||
Name string
|
Name string
|
||||||
Manifest string
|
Manifest string
|
||||||
Version int32
|
Version int32
|
||||||
|
Versions int32 `db:"versions"`
|
||||||
IsLatest bool
|
IsLatest bool
|
||||||
IsArchived bool `db:"is_archived"`
|
IsArchived bool `db:"is_archived"`
|
||||||
ArgoWorkflowTemplate *wfv1.WorkflowTemplate
|
ArgoWorkflowTemplate *wfv1.WorkflowTemplate
|
||||||
@@ -70,11 +71,12 @@ type WorkflowTemplate struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type WorkflowExecutionStatisticReport struct {
|
type WorkflowExecutionStatisticReport struct {
|
||||||
Total int32
|
WorkflowTemplateId uint64 `db:"workflow_template_id"`
|
||||||
LastExecuted time.Time
|
Total int32
|
||||||
Running int32
|
LastExecuted time.Time `db:"last_executed"`
|
||||||
Completed int32
|
Running int32
|
||||||
Failed int32
|
Completed int32
|
||||||
|
Failed int32
|
||||||
}
|
}
|
||||||
|
|
||||||
type WorkflowExecutionStatistic struct {
|
type WorkflowExecutionStatistic struct {
|
||||||
|
@@ -1145,43 +1145,66 @@ func (c *Client) SetWorkflowTemplateLabels(namespace, name, prefix string, keyVa
|
|||||||
return filteredMap, nil
|
return filteredMap, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *Client) GetWorkflowExecutionStatisticsForTemplate(workflowTemplate *WorkflowTemplate) (err error) {
|
func (c *Client) GetWorkflowExecutionStatisticsForTemplates(workflowTemplates ...*WorkflowTemplate) (err error) {
|
||||||
|
if len(workflowTemplates) == 0 {
|
||||||
|
return errors.New("GetWorkflowExecutionStatisticsForTemplates requires at least 1 id")
|
||||||
|
}
|
||||||
|
|
||||||
tx, err := c.DB.Begin()
|
tx, err := c.DB.Begin()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
whereIn := "workflow_template_id IN (?"
|
||||||
|
for i := range workflowTemplates {
|
||||||
|
if i == 0 {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
|
whereIn += ",?"
|
||||||
|
}
|
||||||
|
whereIn += ")"
|
||||||
|
|
||||||
|
ids := make([]interface{}, len(workflowTemplates))
|
||||||
|
for i, workflowTemplate := range workflowTemplates {
|
||||||
|
ids[i] = workflowTemplate.ID
|
||||||
|
}
|
||||||
|
|
||||||
defer tx.Rollback()
|
defer tx.Rollback()
|
||||||
|
|
||||||
query, args, err := sb.Select("name, created_at, finished_at, failed_at").
|
statsSelect := `
|
||||||
From("workflow_executions").Where(sq.Eq{"workflow_template_id": workflowTemplate.ID}).OrderBy("created_at DESC").ToSql()
|
workflow_template_id,
|
||||||
if err != nil {
|
MAX(created_at) last_executed,
|
||||||
return err
|
COUNT(*) FILTER (WHERE finished_At IS NULL AND failed_at IS NULL) running,
|
||||||
}
|
COUNT(*) FILTER (WHERE finished_at IS NOT NULL) completed,
|
||||||
var workflowExecStats []WorkflowExecutionStatistic
|
COUNT(*) FILTER (WHERE failed_at IS NOT NULL) failed,
|
||||||
err = c.DB.Select(&workflowExecStats, query, args...)
|
COUNT(*) total`
|
||||||
|
|
||||||
|
query, args, err := sb.Select(statsSelect).
|
||||||
|
From("workflow_executions").
|
||||||
|
Where(whereIn, ids...).
|
||||||
|
GroupBy("workflow_template_id").
|
||||||
|
ToSql()
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
result := make([]*WorkflowExecutionStatisticReport, 0)
|
||||||
workflowTemplate.WorkflowExecutionStatisticReport = &WorkflowExecutionStatisticReport{}
|
err = c.DB.Select(&result, query, args...)
|
||||||
if len(workflowExecStats) == 0 {
|
if err != nil {
|
||||||
return
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
//Calculate and set the values
|
resultMapping := make(map[uint64]*WorkflowExecutionStatisticReport)
|
||||||
workflowTemplate.WorkflowExecutionStatisticReport.Total = int32(len(workflowExecStats))
|
for i := range result {
|
||||||
createdAtTime := workflowExecStats[0].CreatedAt
|
report := result[i]
|
||||||
workflowTemplate.WorkflowExecutionStatisticReport.LastExecuted = *createdAtTime
|
resultMapping[report.WorkflowTemplateId] = report
|
||||||
for _, workflowExecStat := range workflowExecStats {
|
|
||||||
if workflowExecStat.FailedAt != nil {
|
|
||||||
workflowTemplate.WorkflowExecutionStatisticReport.Failed++
|
|
||||||
} else if workflowExecStat.FinishedAt == nil {
|
|
||||||
workflowTemplate.WorkflowExecutionStatisticReport.Running++
|
|
||||||
} else if workflowExecStat.FinishedAt != nil {
|
|
||||||
workflowTemplate.WorkflowExecutionStatisticReport.Completed++
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
for _, workflowTemplate := range workflowTemplates {
|
||||||
|
workflowTemplate.WorkflowExecutionStatisticReport = resultMapping[workflowTemplate.ID]
|
||||||
|
}
|
||||||
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -77,7 +77,7 @@ func (c *Client) createWorkflowTemplate(namespace string, workflowTemplate *Work
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (c *Client) workflowTemplatesSelectBuilder(namespace string) sq.SelectBuilder {
|
func (c *Client) workflowTemplatesSelectBuilder(namespace string) sq.SelectBuilder {
|
||||||
sb := sb.Select("wt.id", "wt.created_at", "wt.uid", "wt.name", "wt.is_archived").
|
sb := sb.Select("wt.id", "wt.created_at", "wt.uid", "wt.name", "wt.is_archived", "wt.versions").
|
||||||
From("workflow_templates wt").
|
From("workflow_templates wt").
|
||||||
Where(sq.Eq{
|
Where(sq.Eq{
|
||||||
"wt.namespace": namespace,
|
"wt.namespace": namespace,
|
||||||
@@ -183,6 +183,8 @@ func (c *Client) listWorkflowTemplateVersions(namespace, uid string) (workflowTe
|
|||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
labels := label.FilterByPrefix(label.TagPrefix, argoTemplate.Labels)
|
||||||
|
|
||||||
newItem := WorkflowTemplate{
|
newItem := WorkflowTemplate{
|
||||||
ID: template.ID,
|
ID: template.ID,
|
||||||
CreatedAt: argoTemplate.CreationTimestamp.Time,
|
CreatedAt: argoTemplate.CreationTimestamp.Time,
|
||||||
@@ -192,6 +194,7 @@ func (c *Client) listWorkflowTemplateVersions(namespace, uid string) (workflowTe
|
|||||||
Version: int32(version),
|
Version: int32(version),
|
||||||
IsLatest: isLatest,
|
IsLatest: isLatest,
|
||||||
IsArchived: template.IsArchived,
|
IsArchived: template.IsArchived,
|
||||||
|
Labels: labels,
|
||||||
}
|
}
|
||||||
|
|
||||||
workflowTemplateVersions = append(workflowTemplateVersions, &newItem)
|
workflowTemplateVersions = append(workflowTemplateVersions, &newItem)
|
||||||
@@ -238,6 +241,26 @@ func (c *Client) archiveWorkflowTemplate(namespace, uid string) (bool, error) {
|
|||||||
return true, nil
|
return true, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (c *Client) updateWorkflowTemplateVersions(namespace, uid string) (bool, error) {
|
||||||
|
query, args, err := sb.Update("workflow_templates").
|
||||||
|
Set("versions", sq.Expr("versions + 1")).
|
||||||
|
Where(sq.Eq{
|
||||||
|
"uid": uid,
|
||||||
|
"namespace": namespace,
|
||||||
|
}).
|
||||||
|
ToSql()
|
||||||
|
|
||||||
|
if err != nil {
|
||||||
|
return false, err
|
||||||
|
}
|
||||||
|
|
||||||
|
if _, err := c.DB.Exec(query, args...); err != nil {
|
||||||
|
return false, err
|
||||||
|
}
|
||||||
|
|
||||||
|
return true, nil
|
||||||
|
}
|
||||||
|
|
||||||
func (c *Client) CreateWorkflowTemplate(namespace string, workflowTemplate *WorkflowTemplate) (*WorkflowTemplate, error) {
|
func (c *Client) CreateWorkflowTemplate(namespace string, workflowTemplate *WorkflowTemplate) (*WorkflowTemplate, error) {
|
||||||
// validate workflow template
|
// validate workflow template
|
||||||
finalBytes, err := workflowTemplate.WrapSpec()
|
finalBytes, err := workflowTemplate.WrapSpec()
|
||||||
@@ -327,6 +350,11 @@ func (c *Client) CreateWorkflowTemplateVersion(namespace string, workflowTemplat
|
|||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
_, err = c.updateWorkflowTemplateVersions(namespace, workflowTemplate.UID)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
return workflowTemplate, nil
|
return workflowTemplate, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -389,15 +417,25 @@ func (c *Client) ListWorkflowTemplates(namespace string) (workflowTemplateVersio
|
|||||||
return nil, util.NewUserError(codes.NotFound, "Workflow templates not found.")
|
return nil, util.NewUserError(codes.NotFound, "Workflow templates not found.")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
err = c.GetWorkflowExecutionStatisticsForTemplates(workflowTemplateVersions...)
|
||||||
|
if err != nil {
|
||||||
|
log.WithFields(log.Fields{
|
||||||
|
"Namespace": namespace,
|
||||||
|
"Error": err.Error(),
|
||||||
|
}).Error("Unable to get Workflow Execution Statistic for Templates.")
|
||||||
|
return nil, util.NewUserError(codes.NotFound, "Unable to get Workflow Execution Statistic for Templates.")
|
||||||
|
}
|
||||||
for _, workflowTemplate := range workflowTemplateVersions {
|
for _, workflowTemplate := range workflowTemplateVersions {
|
||||||
err = c.GetWorkflowExecutionStatisticsForTemplate(workflowTemplate)
|
labels, err := c.GetWorkflowTemplateLabels(namespace, workflowTemplate.UID, label.TagPrefix, workflowTemplate.Version)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.WithFields(log.Fields{
|
log.WithFields(log.Fields{
|
||||||
"Namespace": namespace,
|
"Namespace": namespace,
|
||||||
"Error": err.Error(),
|
"Error": err.Error(),
|
||||||
}).Error("Unable to get Workflow Execution Statistic for Template.")
|
}).Error("Unable to get GetWorkflowTemplateLabels for Templates.")
|
||||||
return nil, util.NewUserError(codes.NotFound, "Unable to get Workflow Execution Statistic for Template.")
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
|
workflowTemplate.Labels = labels
|
||||||
}
|
}
|
||||||
|
|
||||||
return
|
return
|
||||||
|
@@ -16,3 +16,16 @@ func APIKeyValueToLabel(apiKeyValues []*api.KeyValue) map[string]string {
|
|||||||
|
|
||||||
return result
|
return result
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func MappingToKeyValue(mapping map[string]string) []*api.KeyValue {
|
||||||
|
keyValues := make([]*api.KeyValue, 0)
|
||||||
|
|
||||||
|
for key, value := range mapping {
|
||||||
|
keyValues = append(keyValues, &api.KeyValue{
|
||||||
|
Key: key,
|
||||||
|
Value: value,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
return keyValues
|
||||||
|
}
|
||||||
|
@@ -29,9 +29,11 @@ func apiWorkflowTemplate(wft *v1.WorkflowTemplate) *api.WorkflowTemplate {
|
|||||||
CreatedAt: wft.CreatedAt.UTC().Format(time.RFC3339),
|
CreatedAt: wft.CreatedAt.UTC().Format(time.RFC3339),
|
||||||
Name: wft.Name,
|
Name: wft.Name,
|
||||||
Version: wft.Version,
|
Version: wft.Version,
|
||||||
|
Versions: wft.Versions,
|
||||||
Manifest: manifest,
|
Manifest: manifest,
|
||||||
IsLatest: wft.IsLatest,
|
IsLatest: wft.IsLatest,
|
||||||
IsArchived: wft.IsArchived,
|
IsArchived: wft.IsArchived,
|
||||||
|
Labels: converter.MappingToKeyValue(wft.Labels),
|
||||||
}
|
}
|
||||||
|
|
||||||
if wft.WorkflowExecutionStatisticReport != nil {
|
if wft.WorkflowExecutionStatisticReport != nil {
|
||||||
|
Reference in New Issue
Block a user