#256: Added category dropdown to app editor
This commit is contained in:
@@ -137,6 +137,7 @@ const AngularWorkflow = (props) => {
|
||||
const [workflow, setWorkflow] = React.useState({});
|
||||
const [userSettings, setUserSettings] = React.useState({});
|
||||
const [subworkflow, setSubworkflow] = React.useState({});
|
||||
const [subworkflowStartnode, setSubworkflowStartnode] = React.useState("");
|
||||
const [leftViewOpen, setLeftViewOpen] = React.useState(true);
|
||||
const [leftBarSize, setLeftBarSize] = React.useState(350)
|
||||
const [executionText, setExecutionText] = React.useState("");
|
||||
@@ -783,8 +784,8 @@ const AngularWorkflow = (props) => {
|
||||
//alert.success("Successfully saved workflow")
|
||||
setSavingState(1)
|
||||
setTimeout(() => {
|
||||
setSavingState(0)
|
||||
}, 3000);
|
||||
setSavingState(0)
|
||||
}, 2000);
|
||||
}
|
||||
})
|
||||
.catch(error => {
|
||||
@@ -830,9 +831,9 @@ const AngularWorkflow = (props) => {
|
||||
}
|
||||
|
||||
if (executionArgument.length > 0) {
|
||||
alert.success("Starting execution WITH an execution argument")
|
||||
//alert.success("Starting execution WITH an execution argument")
|
||||
} else {
|
||||
alert.success("Starting execution")
|
||||
//alert.success("Starting execution")
|
||||
}
|
||||
|
||||
const data = {"execution_argument": executionArgument, "start": startNode}
|
||||
@@ -5154,6 +5155,7 @@ const AngularWorkflow = (props) => {
|
||||
setUpdate(Math.random())
|
||||
workflow.triggers[selectedTriggerIndex].parameters[0].value = e.target.value.id
|
||||
setWorkflow(workflow)
|
||||
setSubworkflowStartnode(e.target.value.start)
|
||||
}}
|
||||
style={{backgroundColor: inputColor, color: "white", height: "50px"}}
|
||||
>
|
||||
@@ -5170,9 +5172,9 @@ const AngularWorkflow = (props) => {
|
||||
})}
|
||||
</Select>
|
||||
}
|
||||
{/*subworkflow === undefined || subworkflow === null || subworkflow.id === undefined ? null :
|
||||
{/*subworkflow === undefined || subworkflow === null || subworkflow.id === undefined || subworkflow.actions === null || subworkflow.actions === undefined || subworkflow.actions.length === 0 ? null :
|
||||
<Select
|
||||
value={subworkflow}
|
||||
value={subworkflowStartnode}
|
||||
SelectDisplayProps={{
|
||||
style: {
|
||||
marginLeft: 10,
|
||||
@@ -5181,21 +5183,24 @@ const AngularWorkflow = (props) => {
|
||||
}}
|
||||
fullWidth
|
||||
onChange={(e) => {
|
||||
setSubworkflow(e.target.value)
|
||||
setUpdate(Math.random())
|
||||
workflow.triggers[selectedTriggerIndex].parameters[0].value = e.target.value.id
|
||||
setWorkflow(workflow)
|
||||
console.log("Change startnode to" + e.target)
|
||||
//setSubworkflow(e.target.value)
|
||||
//setUpdate(Math.random())
|
||||
//workflow.triggers[selectedTriggerIndex].parameters[0].value = e.target.value.id
|
||||
//const [subworkflowStartnode, setSubworkflowStartnode] = React.useState("");
|
||||
//setWorkflow(workflow)
|
||||
}}
|
||||
style={{backgroundColor: inputColor, color: "white", height: "50px"}}
|
||||
>
|
||||
{workflows.map((data, index) => {
|
||||
{subworkflow.actions.map((data, index) => {
|
||||
console.log(data)
|
||||
if (data.id === workflow.id) {
|
||||
return null
|
||||
}
|
||||
|
||||
return (
|
||||
<MenuItem key={index} style={{backgroundColor: inputColor, color: "white"}} value={data}>
|
||||
{data.name}
|
||||
{data.index}
|
||||
</MenuItem>
|
||||
)
|
||||
})}
|
||||
|
||||
@@ -444,6 +444,10 @@ const AppCreator = (props) => {
|
||||
}
|
||||
|
||||
if (data.info["x-categories"] !== undefined && data.info["x-categories"].length > 0) {
|
||||
if (typeof(data.info["x-categories"]) == "array") {
|
||||
} else {
|
||||
|
||||
}
|
||||
setNewWorkflowCategories(data.info["x-categories"])
|
||||
}
|
||||
}
|
||||
@@ -1991,31 +1995,20 @@ const AppCreator = (props) => {
|
||||
</FormControl>
|
||||
</Dialog>
|
||||
|
||||
|
||||
const categories = [
|
||||
"Communication",
|
||||
"Cases",
|
||||
"EDR",
|
||||
"Intel",
|
||||
"SIEM",
|
||||
"Network",
|
||||
"Assets",
|
||||
"Other",
|
||||
]
|
||||
const tagView =
|
||||
<div style={{color: "white"}}>
|
||||
<h2>Tags</h2>
|
||||
<ChipInput
|
||||
style={{marginTop: 10}}
|
||||
InputProps={{
|
||||
style:{
|
||||
color: "white",
|
||||
},
|
||||
}}
|
||||
placeholder="Tags"
|
||||
color="primary"
|
||||
fullWidth
|
||||
value={newWorkflowTags}
|
||||
onAdd={(chip) => {
|
||||
newWorkflowTags.push(chip)
|
||||
setNewWorkflowTags(newWorkflowTags)
|
||||
setUpdate("added"+chip)
|
||||
}}
|
||||
onDelete={(chip, index) => {
|
||||
newWorkflowTags.splice(index, 1)
|
||||
setNewWorkflowTags(newWorkflowTags)
|
||||
setUpdate("delete "+chip)
|
||||
}}
|
||||
/>
|
||||
{/*
|
||||
<ChipInput
|
||||
style={{marginTop: 10}}
|
||||
InputProps={{
|
||||
@@ -2038,6 +2031,51 @@ const AppCreator = (props) => {
|
||||
setUpdate("delete "+chip)
|
||||
}}
|
||||
/>
|
||||
*/}
|
||||
<h4>Categories</h4>
|
||||
<Select
|
||||
fullWidth
|
||||
SelectDisplayProps={{
|
||||
style: {
|
||||
marginLeft: 10,
|
||||
}
|
||||
}}
|
||||
onChange={(e) => {
|
||||
setNewWorkflowCategories([e.target.value])
|
||||
setUpdate("added "+e.target.value)
|
||||
}}
|
||||
value={newWorkflowCategories.length === 0 ? "Select a category" : newWorkflowCategories[0]}
|
||||
style={{backgroundColor: inputColor, color: "white", height: "50px"}}
|
||||
>
|
||||
{categories.map(data => (
|
||||
<MenuItem style={{backgroundColor: inputColor, color: "white"}} value={data}>
|
||||
{data}
|
||||
</MenuItem>
|
||||
))}
|
||||
</Select>
|
||||
<h4>Tags</h4>
|
||||
<ChipInput
|
||||
style={{marginTop: 10}}
|
||||
InputProps={{
|
||||
style:{
|
||||
color: "white",
|
||||
},
|
||||
}}
|
||||
placeholder="Tags"
|
||||
color="primary"
|
||||
fullWidth
|
||||
value={newWorkflowTags}
|
||||
onAdd={(chip) => {
|
||||
newWorkflowTags.push(chip)
|
||||
setNewWorkflowTags(newWorkflowTags)
|
||||
setUpdate("added"+chip)
|
||||
}}
|
||||
onDelete={(chip, index) => {
|
||||
newWorkflowTags.splice(index, 1)
|
||||
setNewWorkflowTags(newWorkflowTags)
|
||||
setUpdate("delete "+chip)
|
||||
}}
|
||||
/>
|
||||
</div>
|
||||
|
||||
const actionView =
|
||||
|
||||
Reference in New Issue
Block a user