Skip to content

Commit 8af7416

Browse files
committed
2 parents 203f342 + aee45e7 commit 8af7416

File tree

2 files changed

+80
-30
lines changed

2 files changed

+80
-30
lines changed

shared.go

Lines changed: 79 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -5641,45 +5641,94 @@ func SetNewWorkflow(resp http.ResponseWriter, request *http.Request) {
56415641
}
56425642
}
56435643

5644-
for _, item := range workflowapps {
5645-
//log.Printf("NAME: %s", item.Name)
5646-
if (item.Name == "Shuffle Tools" || item.Name == "Shuffle-Tools") && item.AppVersion == "1.2.0" {
5647-
//nodeId := "40447f30-fa44-4a4f-a133-4ee710368737"
5648-
nodeId := uuid.NewV4().String()
5649-
workflow.Start = nodeId
5650-
newAction := Action{
5651-
Label: "Change Me",
5652-
Name: "repeat_back_to_me",
5653-
Environment: envName,
5654-
Parameters: []WorkflowAppActionParameter{
5655-
WorkflowAppActionParameter{
5656-
Name: "call",
5657-
Value: "Hello world",
5658-
Example: "Repeating: Hello World",
5659-
Multiline: true,
5644+
if workflow.WorkflowAsCode {
5645+
// if cloud, activate the app with name Shuffle Tools Fork: 3e320a20966d33c9b7e6790b2705f0bf
5646+
if project.Environment == "cloud" {
5647+
app, err := GetApp(ctx, "3e320a20966d33c9b7e6790b2705f0bf", user, false)
5648+
if err != nil {
5649+
log.Printf("[ERROR] Failed getting app: %s", err)
5650+
} else {
5651+
nodeId := uuid.NewV4().String()
5652+
workflow.Start = nodeId
5653+
newAction := Action{
5654+
Label: "Change Me",
5655+
Name: "execute_python",
5656+
Environment: envName,
5657+
Parameters: []WorkflowAppActionParameter{
5658+
WorkflowAppActionParameter{
5659+
Name: "call",
5660+
Value: "print('Hello world')",
5661+
Example: "Repeating: Hello World",
5662+
Multiline: true,
5663+
},
56605664
},
5661-
},
5662-
Priority: 0,
5663-
Errors: []string{},
5664-
ID: nodeId,
5665-
IsValid: true,
5666-
IsStartNode: true,
5667-
Sharing: true,
5668-
PrivateID: "",
5669-
SmallImage: "",
5670-
AppName: item.Name,
5671-
AppVersion: item.AppVersion,
5672-
AppID: item.ID,
5673-
LargeImage: item.LargeImage,
5665+
Priority: 0,
5666+
Errors: []string{},
5667+
ID: nodeId,
5668+
IsValid: true,
5669+
IsStartNode: true,
5670+
Sharing: true,
5671+
PrivateID: "",
5672+
SmallImage: "",
5673+
AppName: app.Name,
5674+
AppVersion: app.AppVersion,
5675+
AppID: app.ID,
5676+
LargeImage: app.LargeImage,
56745677
}
5678+
56755679
newAction.Position = Position{
56765680
X: 449.5,
56775681
Y: 446,
56785682
}
56795683

56805684
newActions = append(newActions, newAction)
5685+
}
56815686

5682-
break
5687+
} else {
5688+
// figure out a way to activate Shuffle-Tools-Fork for everyone onprem
5689+
}
5690+
5691+
} else {
5692+
for _, item := range workflowapps {
5693+
//log.Printf("NAME: %s", item.Name)
5694+
if (item.Name == "Shuffle Tools" || item.Name == "Shuffle-Tools") && item.AppVersion == "1.2.0" {
5695+
//nodeId := "40447f30-fa44-4a4f-a133-4ee710368737"
5696+
nodeId := uuid.NewV4().String()
5697+
workflow.Start = nodeId
5698+
newAction := Action{
5699+
Label: "Change Me",
5700+
Name: "repeat_back_to_me",
5701+
Environment: envName,
5702+
Parameters: []WorkflowAppActionParameter{
5703+
WorkflowAppActionParameter{
5704+
Name: "call",
5705+
Value: "Hello world",
5706+
Example: "Repeating: Hello World",
5707+
Multiline: true,
5708+
},
5709+
},
5710+
Priority: 0,
5711+
Errors: []string{},
5712+
ID: nodeId,
5713+
IsValid: true,
5714+
IsStartNode: true,
5715+
Sharing: true,
5716+
PrivateID: "",
5717+
SmallImage: "",
5718+
AppName: item.Name,
5719+
AppVersion: item.AppVersion,
5720+
AppID: item.ID,
5721+
LargeImage: item.LargeImage,
5722+
}
5723+
newAction.Position = Position{
5724+
X: 449.5,
5725+
Y: 446,
5726+
}
5727+
5728+
newActions = append(newActions, newAction)
5729+
5730+
break
5731+
}
56835732
}
56845733
}
56855734
}

structs.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1270,6 +1270,7 @@ type FormControl struct {
12701270
}
12711271

12721272
type Workflow struct {
1273+
WorkflowAsCode bool `json:"workflow_as_code" datastore:"workflow_as_code"`
12731274
Actions []Action `json:"actions" datastore:"actions,noindex"`
12741275
Branches []Branch `json:"branches" datastore:"branches,noindex"`
12751276
VisualBranches []Branch `json:"visual_branches" datastore:"visual_branches,noindex"`

0 commit comments

Comments
 (0)