diff --git a/backend/go-app/main.go b/backend/go-app/main.go index 9835af3d..14db7510 100644 --- a/backend/go-app/main.go +++ b/backend/go-app/main.go @@ -7099,7 +7099,7 @@ func runInit(ctx context.Context) { // Fixing workflows to have real activeorg IDs if len(activeOrgs) == 1 { - q := datastore.NewQuery("workflow") + q := datastore.NewQuery("workflow").Limit(35) var workflows []Workflow _, err = dbclient.GetAll(ctx, q, &workflows) if err != nil { @@ -7383,7 +7383,7 @@ func runInit(ctx context.Context) { workflowLocation := os.Getenv("SHUFFLE_DOWNLOAD_WORKFLOW_LOCATION") if len(workflowLocation) > 0 { log.Printf("Downloading WORKFLOWS from %s if no workflows - EXTRA workflows", workflowLocation) - q := datastore.NewQuery("workflow") + q := datastore.NewQuery("workflow").Limit(35) var workflows []Workflow _, err = dbclient.GetAll(ctx, q, &workflows) if err != nil { diff --git a/backend/go-app/walkoff.go b/backend/go-app/walkoff.go index e9899dda..37f6f3d8 100644 --- a/backend/go-app/walkoff.go +++ b/backend/go-app/walkoff.go @@ -178,6 +178,7 @@ type WorkflowAppActionParameter struct { Name string `json:"name" datastore:"name" yaml:"name"` Example string `json:"example" datastore:"example" yaml:"example"` Value string `json:"value" datastore:"value,noindex" yaml:"value,omitempty"` + ValueReplace []ValueReplace `json:"value_replace" datastore:"value_replace,noindex" yaml:"value_replace,omitempty"` Multiline bool `json:"multiline" datastore:"multiline" yaml:"multiline"` Options []string `json:"options" datastore:"options" yaml:"options"` ActionField string `json:"action_field" datastore:"action_field" yaml:"actionfield,omitempty"` @@ -189,6 +190,11 @@ type WorkflowAppActionParameter struct { SkipMulticheck bool `json:"skip_multicheck" datastore:"skip_multicheck" yaml:"skip_multicheck"` } +type ValueReplace struct { + Key string `json:"key" datastore:"key"` + Value string `json:"value" datastore:"value"` +} + type SchemaDefinition struct { Type string `json:"type" datastore:"type"` } diff --git a/frontend/src/views/AngularWorkflow.jsx b/frontend/src/views/AngularWorkflow.jsx index 9dddd448..b7b61921 100644 --- a/frontend/src/views/AngularWorkflow.jsx +++ b/frontend/src/views/AngularWorkflow.jsx @@ -2225,6 +2225,14 @@ const AngularWorkflow = (props) => { var newAppPopup = false + /* + FIXME: Add auth. + selectedAction.selectedAuthentication = e.target.value + selectedAction.authentication_id = e.target.value.id + setSelectedAction(selectedAction) + setUpdate(Math.random()) + */ + const newAppData = { app_name: app.name, app_version: app.app_version, @@ -2872,6 +2880,19 @@ const AngularWorkflow = (props) => { placeholder = data.example } + if (data.name.startsWith("${") && data.name.endsWith("}")) { + const paramcheck = selectedAction.parameters.find(param => param.name === "body") + if (paramcheck !== undefined) { + if (paramcheck["value_replace"] !== undefined) { + console.log("IN THE VALUE REPLACE: ", paramcheck["value_replace"]) + const subparamindex = paramcheck["value_replace"].findIndex(param => param.key === data.name) + if (subparamindex !== -1) { + data.value = paramcheck["value_replace"][subparamindex]["value"] + } + } + } + } + var disabled = false var rows = "5" var openApiHelperText = "This is an OpenAPI specific field" @@ -2927,6 +2948,7 @@ const AngularWorkflow = (props) => { } } + console.log("Data: ", data) var datafield = { type={placeholder.includes("***") ? "password" : "text"} placeholder={placeholder} onChange={(event) => { - changeActionParameter(event, count) + if (data.name.startsWith("${") && data.name.endsWith("}")) { + // PARAM FIX - Gonna use the ID field, even though it's a hack + const paramcheck = selectedAction.parameters.find(param => param.name === "body") + if (paramcheck !== undefined) { + if (paramcheck["value_replace"] === undefined) { + paramcheck["value_replace"] = [{ + "key": data.name, + "value": event.target.value, + }] + + } else { + const subparamindex = paramcheck["value_replace"].findIndex(param => param.key === data.name) + if (subparamindex === -1) { + paramcheck["value_replace"].push({ + "key": data.name, + "value": event.target.value, + }) + } else { + paramcheck["value_replace"][subparamindex]["value"] = event.target.value + } + } + //console.log("PARAM: ", paramcheck) + } + } else { + changeActionParameter(event, count) + } }} helperText={selectedApp.generated && selectedApp.activated && data.name === "body" ? {openApiHelperText} : + data.name.startsWith("${") && data.name.endsWith("}") ? + + OpenAPI helperfield + + : null } onBlur={(event) => {