Skip to content

Commit

Permalink
ADD flow action type checker.
Browse files Browse the repository at this point in the history
ADD flow action type checker.
  • Loading branch information
karminski committed Jan 26, 2024
1 parent 016aacf commit e9318c5
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions src/controller/flow_action.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import (
"github.com/illacloud/builder-backend/src/response"
"github.com/illacloud/builder-backend/src/utils/accesscontrol"
"github.com/illacloud/builder-backend/src/utils/illaresourcemanagersdk"
"github.com/illacloud/builder-backend/src/utils/resourcelist"
)

func (controller *Controller) CreateFlowAction(c *gin.Context) {
Expand Down Expand Up @@ -347,12 +348,15 @@ func (controller *Controller) RunFlowAction(c *gin.Context) {
fmt.Printf("[DUMP] flowAction: %+v\n", flowAction)

// process input context with action template
processedTemplate, errInProcessTemplate := common.ProcessTemplateByContext(flowAction.ExportTemplateInMap(), runFlowActionRequest.ExportContext())
if errInProcessTemplate != nil {
controller.FeedbackBadRequest(c, ERROR_FLAG_CAN_NOT_PROCESS_FLOW_ACTION, "process flow action failed: "+errInProcessTemplate.Error())
return
// @todo: this method should rewrite to common method for all flow actions.
if flowAction.ExportType() == resourcelist.TYPE_MONGODB_ID {
processedTemplate, errInProcessTemplate := common.ProcessTemplateByContext(flowAction.ExportTemplateInMap(), runFlowActionRequest.ExportContext())
if errInProcessTemplate != nil {
controller.FeedbackBadRequest(c, ERROR_FLAG_CAN_NOT_PROCESS_FLOW_ACTION, "process flow action failed: "+errInProcessTemplate.Error())
return
}
flowAction.SetTemplate(processedTemplate)
}
flowAction.SetTemplate(processedTemplate)

// assembly flowAction
flowActionFactory := model.NewFlowActionFactoryByFlowAction(flowAction)
Expand Down

0 comments on commit e9318c5

Please sign in to comment.