Added optional parameter parsing from OpenAPI
This commit is contained in:
@@ -7099,7 +7099,7 @@ func runInit(ctx context.Context) {
|
|||||||
|
|
||||||
// Fixing workflows to have real activeorg IDs
|
// Fixing workflows to have real activeorg IDs
|
||||||
if len(activeOrgs) == 1 {
|
if len(activeOrgs) == 1 {
|
||||||
q := datastore.NewQuery("workflow")
|
q := datastore.NewQuery("workflow").Limit(35)
|
||||||
var workflows []Workflow
|
var workflows []Workflow
|
||||||
_, err = dbclient.GetAll(ctx, q, &workflows)
|
_, err = dbclient.GetAll(ctx, q, &workflows)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@@ -7383,7 +7383,7 @@ func runInit(ctx context.Context) {
|
|||||||
workflowLocation := os.Getenv("SHUFFLE_DOWNLOAD_WORKFLOW_LOCATION")
|
workflowLocation := os.Getenv("SHUFFLE_DOWNLOAD_WORKFLOW_LOCATION")
|
||||||
if len(workflowLocation) > 0 {
|
if len(workflowLocation) > 0 {
|
||||||
log.Printf("Downloading WORKFLOWS from %s if no workflows - EXTRA workflows", workflowLocation)
|
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
|
var workflows []Workflow
|
||||||
_, err = dbclient.GetAll(ctx, q, &workflows)
|
_, err = dbclient.GetAll(ctx, q, &workflows)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|||||||
@@ -178,6 +178,7 @@ type WorkflowAppActionParameter struct {
|
|||||||
Name string `json:"name" datastore:"name" yaml:"name"`
|
Name string `json:"name" datastore:"name" yaml:"name"`
|
||||||
Example string `json:"example" datastore:"example" yaml:"example"`
|
Example string `json:"example" datastore:"example" yaml:"example"`
|
||||||
Value string `json:"value" datastore:"value,noindex" yaml:"value,omitempty"`
|
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"`
|
Multiline bool `json:"multiline" datastore:"multiline" yaml:"multiline"`
|
||||||
Options []string `json:"options" datastore:"options" yaml:"options"`
|
Options []string `json:"options" datastore:"options" yaml:"options"`
|
||||||
ActionField string `json:"action_field" datastore:"action_field" yaml:"actionfield,omitempty"`
|
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"`
|
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 SchemaDefinition struct {
|
||||||
Type string `json:"type" datastore:"type"`
|
Type string `json:"type" datastore:"type"`
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2225,6 +2225,14 @@ const AngularWorkflow = (props) => {
|
|||||||
|
|
||||||
var newAppPopup = false
|
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 = {
|
const newAppData = {
|
||||||
app_name: app.name,
|
app_name: app.name,
|
||||||
app_version: app.app_version,
|
app_version: app.app_version,
|
||||||
@@ -2872,6 +2880,19 @@ const AngularWorkflow = (props) => {
|
|||||||
placeholder = data.example
|
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 disabled = false
|
||||||
var rows = "5"
|
var rows = "5"
|
||||||
var openApiHelperText = "This is an OpenAPI specific field"
|
var openApiHelperText = "This is an OpenAPI specific field"
|
||||||
@@ -2927,6 +2948,7 @@ const AngularWorkflow = (props) => {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
console.log("Data: ", data)
|
||||||
var datafield =
|
var datafield =
|
||||||
<TextField
|
<TextField
|
||||||
disabled={disabled}
|
disabled={disabled}
|
||||||
@@ -2963,13 +2985,43 @@ const AngularWorkflow = (props) => {
|
|||||||
type={placeholder.includes("***") ? "password" : "text"}
|
type={placeholder.includes("***") ? "password" : "text"}
|
||||||
placeholder={placeholder}
|
placeholder={placeholder}
|
||||||
onChange={(event) => {
|
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" ?
|
helperText={selectedApp.generated && selectedApp.activated && data.name === "body" ?
|
||||||
<span style={{color:"white", marginBottom: 5,}}>
|
<span style={{color:"white", marginBottom: 5,}}>
|
||||||
{openApiHelperText}
|
{openApiHelperText}
|
||||||
</span>
|
</span>
|
||||||
:
|
:
|
||||||
|
data.name.startsWith("${") && data.name.endsWith("}") ?
|
||||||
|
<span style={{color:"white", marginBottom: 5,}}>
|
||||||
|
OpenAPI helperfield
|
||||||
|
</span>
|
||||||
|
:
|
||||||
null
|
null
|
||||||
}
|
}
|
||||||
onBlur={(event) => {
|
onBlur={(event) => {
|
||||||
|
|||||||
Reference in New Issue
Block a user