Skip to content

Commit

Permalink
Merge pull request #33 from 0x0elliot/0x0elliot/unnecessary-image-rem…
Browse files Browse the repository at this point in the history
…oval

fix: removing unnecessary images
  • Loading branch information
frikky authored Sep 6, 2023
2 parents 0082130 + 0216f85 commit b62ccae
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 1 deletion.
10 changes: 9 additions & 1 deletion db-connector.go
Original file line number Diff line number Diff line change
Expand Up @@ -1192,6 +1192,9 @@ func sanitizeString(input string) string {
}

func Fixexecution(ctx context.Context, workflowExecution WorkflowExecution) WorkflowExecution {
workflowExecution.Workflow.Image = ""


// Make sure to not having missing items in the execution
lastexecVar := map[string]ActionResult{}
for _, action := range workflowExecution.Workflow.Actions {
Expand Down Expand Up @@ -1260,11 +1263,16 @@ func Fixexecution(ctx context.Context, workflowExecution WorkflowExecution) Work

// Don't forget any!!
extra := 0
for _, trigger := range workflowExecution.Workflow.Triggers {
for triggerIndex, trigger := range workflowExecution.Workflow.Triggers {
if trigger.TriggerType != "SUBFLOW" && trigger.TriggerType != "USERINPUT" {
continue
}

trigger.LargeImage = ""
trigger.SmallImage = ""

workflowExecution.Workflow.Triggers[triggerIndex] = trigger

extra += 1

found := false
Expand Down
9 changes: 9 additions & 0 deletions shared.go
Original file line number Diff line number Diff line change
Expand Up @@ -3011,6 +3011,7 @@ func GetWorkflowExecutions(resp http.ResponseWriter, request *http.Request) {
for index, execution := range workflowExecutions {
newResults := []ActionResult{}
newActions := []Action{}
newTriggers := []Trigger{}

// Results
for _, result := range execution.Results {
Expand Down Expand Up @@ -3044,8 +3045,16 @@ func GetWorkflowExecutions(resp http.ResponseWriter, request *http.Request) {
newActions = append(newActions, action)
}

for _, trigger := range execution.Workflow.Triggers {
trigger.LargeImage = ""
trigger.SmallImage = ""
newTriggers = append(newTriggers, trigger)
}

workflowExecutions[index].Results = newResults
workflowExecutions[index].Workflow.Actions = newActions
workflowExecutions[index].Workflow.Image = ""
workflowExecutions[index].Workflow.Triggers = newTriggers
}

newjson, err := json.Marshal(workflowExecutions)
Expand Down

0 comments on commit b62ccae

Please sign in to comment.