Skip to content

Commit

Permalink
Merge pull request #169 from actiontech/fix_workflow_status_filter
Browse files Browse the repository at this point in the history
fix workflow status filter
  • Loading branch information
drivebyer committed Dec 17, 2021
2 parents 98c0920 + c7f9746 commit 4e6cf6f
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
11 changes: 10 additions & 1 deletion sqle/api/controller/v1/workflow.go
Original file line number Diff line number Diff line change
Expand Up @@ -822,17 +822,25 @@ func GetWorkflows(c echo.Context) error {
var workflowStatus string
var taskStatus string
var isScheduled bool
var notScheduled bool
// filter task status
switch req.FilterStatus {
case model.WorkflowStatusExecuting:
taskStatus = model.TaskStatusExecuting
case model.WorkflowStatusExecFailed:
taskStatus = model.TaskStatusExecuteFailed
case model.WorkflowStatusFinish:
taskStatus = model.TaskStatusExecuteSucceeded
}
// filter workflow status
switch req.FilterStatus {
case model.WorkflowStatusRunning:
workflowStatus = model.WorkflowStatusRunning
notScheduled = true
case model.WorkflowStatusExecScheduled:
workflowStatus = model.WorkflowStatusRunning
isScheduled = true
default:
case model.WorkflowStatusCancel, model.WorkflowStatusReject:
workflowStatus = req.FilterStatus
}

Expand All @@ -844,6 +852,7 @@ func GetWorkflows(c echo.Context) error {
"filter_status": workflowStatus,
"filter_task_status": taskStatus,
"is_scheduled": isScheduled,
"not_scheduled": notScheduled,
"filter_current_step_type": req.FilterCurrentStepType,
"filter_current_step_assignee_user_name": req.FilterCurrentStepAssigneeUserName,
"filter_task_instance_name": req.FilterTaskInstanceName,
Expand Down
4 changes: 4 additions & 0 deletions sqle/model/workflow_list.go
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,10 @@ AND wr.status = :filter_status
AND wr.scheduled_at IS NOT NULL
{{- end }}
{{- if .not_scheduled }}
AND wr.scheduled_at IS NULL
{{- end }}
{{- if .filter_current_step_assignee_user_name }}
AND curr_ass_user.login_name = :filter_current_step_assignee_user_name
{{- end }}
Expand Down

0 comments on commit 4e6cf6f

Please sign in to comment.