Fixed no selection of execution arguments

This commit is contained in:
frikky
2020-06-19 20:07:10 +02:00
parent a773cdeea8
commit 3096ff31de
+23 -8
View File
@@ -20,6 +20,7 @@ import Divider from '@material-ui/core/Divider';
import Dialog from '@material-ui/core/Dialog'; import Dialog from '@material-ui/core/Dialog';
import DialogActions from '@material-ui/core/DialogActions'; import DialogActions from '@material-ui/core/DialogActions';
import DialogTitle from '@material-ui/core/DialogTitle'; import DialogTitle from '@material-ui/core/DialogTitle';
import InputLabel from '@material-ui/core/InputLabel';
import DialogContent from '@material-ui/core/DialogContent'; import DialogContent from '@material-ui/core/DialogContent';
import FormControl from '@material-ui/core/FormControl'; import FormControl from '@material-ui/core/FormControl';
import IconButton from '@material-ui/core/IconButton'; import IconButton from '@material-ui/core/IconButton';
@@ -906,6 +907,15 @@ const AngularWorkflow = (props) => {
//setStartNode(node.data('id')) //setStartNode(node.data('id'))
workflow.start = node.data('id') workflow.start = node.data('id')
setWorkflow(workflow) setWorkflow(workflow)
} else {
if (workflow.actions === null) {
return
}
for (var key in workflow.actions) {
const action = workflow.actions[key]
console.log("ACTION: ", action)
}
} }
} }
@@ -2636,9 +2646,9 @@ const AngularWorkflow = (props) => {
: null} : null}
{workflow.execution_variables !== undefined && workflow.execution_variables !== null && workflow.execution_variables.length > 0 ? {workflow.execution_variables !== undefined && workflow.execution_variables !== null && workflow.execution_variables.length > 0 ?
<div style={{marginTop: "20px"}}> <div style={{marginTop: "20px"}}>
Execution variables Set execution variable (optional)
<Select <Select
value={selectedAction.execution_variable !== undefined ? selectedAction.execution_variable.name : {"name": "Select a variable"}} value={selectedAction.execution_variable !== undefined ? selectedAction.execution_variable.name : "No selection"}
PaperProps={{ PaperProps={{
style: { style: {
backgroundColor: inputColor, backgroundColor: inputColor,
@@ -2651,19 +2661,24 @@ const AngularWorkflow = (props) => {
}} }}
fullWidth fullWidth
onChange={(e) => { onChange={(e) => {
console.log("Variable", e.target.value) if (e.target.value === "No selection") {
//selectedAction. selectedAction.execution_variable = {"name": "No selection"}
const value = workflow.execution_variables.find(a => a.name === e.target.value.name) } else {
const value = workflow.execution_variables.find(a => a.name === e.target.value)
console.log("FOUND: ", value) console.log("FOUND: ", value)
selectedAction.execution_variable = value selectedAction.execution_variable = value
}
setSelectedAction(selectedAction) setSelectedAction(selectedAction)
//setSelectedActionEnvironment(env) setUpdate("actionname "+e.target.value)
//selectedAction.environment = env.Name
}} }}
style={{backgroundColor: inputColor, color: "white", height: "50px"}} style={{backgroundColor: inputColor, color: "white", height: "50px"}}
> >
<MenuItem style={{backgroundColor: inputColor, color: "white"}} value="No selection">
<em>No selection</em>
</MenuItem>
<Divider />
{workflow.execution_variables.map(data => ( {workflow.execution_variables.map(data => (
<MenuItem style={{backgroundColor: inputColor, color: "white"}} value={data}> <MenuItem style={{backgroundColor: inputColor, color: "white"}} value={data.name}>
{data.name} {data.name}
</MenuItem> </MenuItem>
))} ))}