mirror of
https://github.com/onepanelio/onepanel.git
synced 2025-10-05 13:46:51 +08:00
clean: cleaned up code for getting/setting parameters.
This commit is contained in:
@@ -4,9 +4,7 @@ import (
|
||||
"context"
|
||||
"github.com/onepanelio/core/pkg/util"
|
||||
"github.com/onepanelio/core/server/converter"
|
||||
log "github.com/sirupsen/logrus"
|
||||
"google.golang.org/grpc/codes"
|
||||
"gopkg.in/yaml.v2"
|
||||
"math"
|
||||
"sort"
|
||||
"strings"
|
||||
@@ -46,35 +44,7 @@ func apiWorkflowExecution(wf *v1.WorkflowExecution) (workflow *api.WorkflowExecu
|
||||
}
|
||||
|
||||
if wf.WorkflowTemplate != nil {
|
||||
wftManifestMap, err := v1.RemoveAllButSpec(wf.WorkflowTemplate.GetManifestBytes())
|
||||
if err != nil {
|
||||
log.WithFields(log.Fields{
|
||||
"Method": "apiWorkflowExecution",
|
||||
"Step": "RemoveAllButSpec",
|
||||
"Error": err.Error(),
|
||||
}).Error("Invalid status.")
|
||||
}
|
||||
if wf.WorkflowTemplate.ArgoWorkflowTemplate != nil {
|
||||
v1.AddWorkflowTemplateParametersFromAnnotations(wftManifestMap, wf.WorkflowTemplate.ArgoWorkflowTemplate.Annotations)
|
||||
}
|
||||
|
||||
manifestBytes := []byte{}
|
||||
if wftManifestMap != nil {
|
||||
manifestBytes, err = yaml.Marshal(wftManifestMap)
|
||||
if err != nil {
|
||||
// todo log
|
||||
}
|
||||
}
|
||||
|
||||
workflow.WorkflowTemplate = &api.WorkflowTemplate{
|
||||
Uid: wf.WorkflowTemplate.UID,
|
||||
CreatedAt: wf.WorkflowTemplate.CreatedAt.UTC().Format(time.RFC3339),
|
||||
Name: wf.WorkflowTemplate.Name,
|
||||
Version: wf.WorkflowTemplate.Version,
|
||||
Manifest: string(manifestBytes),
|
||||
IsLatest: wf.WorkflowTemplate.IsLatest,
|
||||
IsArchived: wf.WorkflowTemplate.IsArchived,
|
||||
}
|
||||
workflow.WorkflowTemplate = apiWorkflowTemplate(wf.WorkflowTemplate)
|
||||
}
|
||||
|
||||
return
|
||||
|
Reference in New Issue
Block a user