Fixed workflow editing things
This commit is contained in:
@@ -338,26 +338,6 @@ const EditWorkflow = (props) => {
|
|||||||
autoFocus
|
autoFocus
|
||||||
fullWidth
|
fullWidth
|
||||||
/>
|
/>
|
||||||
<div style={{display: "flex", }}>
|
|
||||||
<TextField
|
|
||||||
onBlur={(event) => {
|
|
||||||
setDescription(event.target.value)
|
|
||||||
}}
|
|
||||||
InputProps={{
|
|
||||||
style: {
|
|
||||||
color: "white",
|
|
||||||
},
|
|
||||||
}}
|
|
||||||
maxRows={4}
|
|
||||||
color="primary"
|
|
||||||
defaultValue={innerWorkflow.description}
|
|
||||||
placeholder="Description"
|
|
||||||
multiline
|
|
||||||
label="Description"
|
|
||||||
margin="dense"
|
|
||||||
fullWidth
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
<div style={{display: "flex", marginTop: 10, }}>
|
<div style={{display: "flex", marginTop: 10, }}>
|
||||||
{usecases !== null && usecases !== undefined && usecases.length > 0 ?
|
{usecases !== null && usecases !== undefined && usecases.length > 0 ?
|
||||||
<FormControl style={{flex: 1, marginRight: 5,}}>
|
<FormControl style={{flex: 1, marginRight: 5,}}>
|
||||||
@@ -425,27 +405,56 @@ const EditWorkflow = (props) => {
|
|||||||
fullWidth
|
fullWidth
|
||||||
value={newWorkflowTags}
|
value={newWorkflowTags}
|
||||||
onChange={(chip) => {
|
onChange={(chip) => {
|
||||||
console.log("Chip: ", chip)
|
|
||||||
//newWorkflowTags.push(chip);
|
|
||||||
setNewWorkflowTags(chip);
|
setNewWorkflowTags(chip);
|
||||||
}}
|
}}
|
||||||
|
onBlur={(event) => {
|
||||||
|
if (event.target.value.length === 0) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
if (newWorkflowTags.includes(event.target.value)) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
newWorkflowTags.push(event.target.value)
|
||||||
|
setNewWorkflowTags(newWorkflowTags)
|
||||||
|
|
||||||
|
setUpdate(Math.random())
|
||||||
|
}}
|
||||||
onAdd={(chip) => {
|
onAdd={(chip) => {
|
||||||
newWorkflowTags.push(chip);
|
newWorkflowTags.push(chip)
|
||||||
setNewWorkflowTags(newWorkflowTags);
|
setNewWorkflowTags(newWorkflowTags)
|
||||||
}}
|
}}
|
||||||
onDelete={(chip, index) => {
|
onDelete={(chip, index) => {
|
||||||
console.log("Deleting: ", chip, index)
|
console.log("Deleting: ", chip, index)
|
||||||
newWorkflowTags.splice(index, 1);
|
newWorkflowTags.splice(index, 1)
|
||||||
setNewWorkflowTags(newWorkflowTags);
|
setNewWorkflowTags(newWorkflowTags)
|
||||||
setUpdate(Math.random());
|
setUpdate(Math.random())
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{showMoreClicked === true ?
|
{showMoreClicked === true ?
|
||||||
<span style={{marginTop: 25, }}>
|
<div style={{marginTop: 50, }}>
|
||||||
|
<TextField
|
||||||
|
onBlur={(event) => {
|
||||||
|
setDescription(event.target.value)
|
||||||
|
}}
|
||||||
|
InputProps={{
|
||||||
|
style: {
|
||||||
|
color: "white",
|
||||||
|
},
|
||||||
|
}}
|
||||||
|
multiLine
|
||||||
|
rows={3}
|
||||||
|
color="primary"
|
||||||
|
defaultValue={innerWorkflow.description}
|
||||||
|
placeholder="Description"
|
||||||
|
multiline
|
||||||
|
label="Description"
|
||||||
|
margin="dense"
|
||||||
|
fullWidth
|
||||||
|
/>
|
||||||
|
|
||||||
<div style={{display: "flex"}}>
|
<div style={{display: "flex"}}>
|
||||||
<FormControl style={{marginTop: 15, }}>
|
<FormControl style={{marginTop: 15, }}>
|
||||||
@@ -564,6 +573,8 @@ const EditWorkflow = (props) => {
|
|||||||
fullWidth
|
fullWidth
|
||||||
/>
|
/>
|
||||||
|
|
||||||
|
<Divider style={{marginTop: 20, marginBottom: 20, }} />
|
||||||
|
|
||||||
<Typography variant="body1" style={{marginTop: 50, }}>
|
<Typography variant="body1" style={{marginTop: 50, }}>
|
||||||
MSSP Suborg Distribution (beta - contact support@shuffler.io for more info)
|
MSSP Suborg Distribution (beta - contact support@shuffler.io for more info)
|
||||||
</Typography>
|
</Typography>
|
||||||
@@ -669,6 +680,7 @@ const EditWorkflow = (props) => {
|
|||||||
</Link>
|
</Link>
|
||||||
}
|
}
|
||||||
|
|
||||||
|
<Divider style={{marginTop: 20, marginBottom: 20, }} />
|
||||||
|
|
||||||
<Typography variant="h6" style={{marginTop: 50, }}>
|
<Typography variant="h6" style={{marginTop: 50, }}>
|
||||||
Input fields
|
Input fields
|
||||||
@@ -781,6 +793,7 @@ const EditWorkflow = (props) => {
|
|||||||
<AddIcon style={{}} />
|
<AddIcon style={{}} />
|
||||||
</Button>
|
</Button>
|
||||||
|
|
||||||
|
<Divider style={{marginTop: 20, marginBottom: 20, }} />
|
||||||
|
|
||||||
<Typography variant="body1" style={{marginTop: 50, }}>
|
<Typography variant="body1" style={{marginTop: 50, }}>
|
||||||
Git Backup Repository
|
Git Backup Repository
|
||||||
@@ -931,7 +944,7 @@ const EditWorkflow = (props) => {
|
|||||||
</span>
|
</span>
|
||||||
</Grid>
|
</Grid>
|
||||||
</Grid>
|
</Grid>
|
||||||
</span>
|
</div>
|
||||||
: null}
|
: null}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -471,32 +471,26 @@ const AuthenticationOauth2 = (props) => {
|
|||||||
state += `%26refresh_uri%3d${authentication_url}`;
|
state += `%26refresh_uri%3d${authentication_url}`;
|
||||||
}
|
}
|
||||||
|
|
||||||
// No prompt forcing
|
// FIXME: Should this be =consent?
|
||||||
//var url = `${authenticationType.redirect_uri}?client_id=${client_id}&redirect_uri=${redirectUri}&response_type=code&prompt=login&scope=${resources}&state=${state}&access_type=offline`;
|
|
||||||
var defaultPrompt = "login"
|
var defaultPrompt = "login"
|
||||||
if (prompt !== undefined && prompt !== null && prompt.length > 0) {
|
if (prompt !== undefined && prompt !== null && prompt.length > 0) {
|
||||||
defaultPrompt = prompt
|
defaultPrompt = prompt
|
||||||
}
|
}
|
||||||
|
|
||||||
var url = `${authenticationType.redirect_uri}?client_id=${client_id}&redirect_uri=${redirectUri}&response_type=code&prompt=${defaultPrompt}&scope=${resources}&state=${state}&access_type=offline`;
|
var url = `${authenticationType.redirect_uri}?client_id=${client_id}&redirect_uri=${redirectUri}&response_type=code&prompt=${defaultPrompt}&scope=${resources}&state=${state}&access_type=offline`;
|
||||||
|
|
||||||
if (admin_consent === true) {
|
if (admin_consent === true) {
|
||||||
console.log("Running Oauth2 WITH admin consent")
|
console.log("Running Oauth2 WITH admin consent")
|
||||||
//url = `${authenticationType.redirect_uri}?client_id=${client_id}&redirect_uri=${redirectUri}&response_type=code&prompt=consent&scope=${resources}&state=${state}&access_type=offline`;
|
//url = `${authenticationType.redirect_uri}?client_id=${client_id}&redirect_uri=${redirectUri}&response_type=code&prompt=consent&scope=${resources}&state=${state}&access_type=offline`;
|
||||||
url = `${authenticationType.redirect_uri}?client_id=${client_id}&redirect_uri=${redirectUri}&response_type=code&prompt=admin_consent&scope=${resources}&state=${state}&access_type=offline`;
|
url = `${authenticationType.redirect_uri}?client_id=${client_id}&redirect_uri=${redirectUri}&response_type=code&prompt=admin_consent&scope=${resources}&state=${state}&access_type=offline`;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Force new consent
|
console.log("OAUTH2 URL: ", url)
|
||||||
|
|
||||||
|
// Force new consent
|
||||||
//const url = `${authenticationType.redirect_uri}?client_id=${client_id}&redirect_uri=${redirectUri}&response_type=code&scope=${resources}&prompt=consent&state=${state}&access_type=offline`;
|
//const url = `${authenticationType.redirect_uri}?client_id=${client_id}&redirect_uri=${redirectUri}&response_type=code&scope=${resources}&prompt=consent&state=${state}&access_type=offline`;
|
||||||
|
|
||||||
// Admin consent
|
// Admin consent
|
||||||
//const url = `https://accounts.zoho.com/oauth/v2/auth?response_type=code&client_id=${client_id}&scope=AaaServer.profile.Read&redirect_uri=${redirectUri}&prompt=consent`
|
//const url = `https://accounts.zoho.com/oauth/v2/auth?response_type=code&client_id=${client_id}&scope=AaaServer.profile.Read&redirect_uri=${redirectUri}&prompt=consent`
|
||||||
|
|
||||||
// &resource=https%3A%2F%2Fgraph.microsoft.com&
|
|
||||||
|
|
||||||
// FIXME: Awful, but works for prototyping
|
|
||||||
// How can we get a callback properly realtime?
|
|
||||||
// How can we properly try-catch without breaks on error?
|
|
||||||
try {
|
try {
|
||||||
var newwin = window.open(url, "", "width=582,height=700");
|
var newwin = window.open(url, "", "width=582,height=700");
|
||||||
//console.log(newwin)
|
//console.log(newwin)
|
||||||
|
|||||||
@@ -3745,7 +3745,7 @@ If you're interested, please let me know a time that works for you, or set up a
|
|||||||
aria-label="disabled tabs example"
|
aria-label="disabled tabs example"
|
||||||
>
|
>
|
||||||
<Tab label=<span>Edit Details</span> />
|
<Tab label=<span>Edit Details</span> />
|
||||||
<Tab label=<span>Org Limits & Cloud Sync</span> />
|
<Tab label=<span>Limits & Cloud Sync</span> />
|
||||||
<Tab label=<span>Priorities</span> />
|
<Tab label=<span>Priorities</span> />
|
||||||
<Tab label=<span>Billing & Stats</span> />
|
<Tab label=<span>Billing & Stats</span> />
|
||||||
<Tab disabled={!isCloud} label=<span>Branding (Beta)</span> />
|
<Tab disabled={!isCloud} label=<span>Branding (Beta)</span> />
|
||||||
|
|||||||
@@ -5294,7 +5294,59 @@ const releaseToConnectLabel = "Release to Connect"
|
|||||||
}
|
}
|
||||||
|
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
setSelectedTriggerIndex(trigger_index);
|
if (trigger_index !== -1) {
|
||||||
|
const trigger = workflow.triggers[trigger_index]
|
||||||
|
if (trigger !== undefined && trigger !== null) {
|
||||||
|
|
||||||
|
// Autofixer
|
||||||
|
if (trigger.trigger_type === "USERINPUT") {
|
||||||
|
const relevantparams = [
|
||||||
|
"alertinfo",
|
||||||
|
"options",
|
||||||
|
"type",
|
||||||
|
"email",
|
||||||
|
"sms",
|
||||||
|
"subflow",
|
||||||
|
]
|
||||||
|
var foundparams = 0
|
||||||
|
for (var paramkey in trigger.parameters) {
|
||||||
|
if (relevantparams.includes(trigger.parameters[paramkey].name)) {
|
||||||
|
foundparams++
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (foundparams < 6) {
|
||||||
|
trigger.parameters = [{
|
||||||
|
name: "alertinfo",
|
||||||
|
value: "Do you want to continue the workflow? Start parameters: $exec",
|
||||||
|
},{
|
||||||
|
name: "options",
|
||||||
|
value: "boolean",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "type",
|
||||||
|
value: "subflow",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "email",
|
||||||
|
value: "test@test.com",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "sms",
|
||||||
|
value: "0000000",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "subflow",
|
||||||
|
value: "",
|
||||||
|
}]
|
||||||
|
|
||||||
|
workflow.triggers[trigger_index].parameters = trigger.parameters
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
setSelectedTriggerIndex(trigger_index)
|
||||||
setSelectedTrigger(data)
|
setSelectedTrigger(data)
|
||||||
setSelectedActionEnvironment(data.env)
|
setSelectedActionEnvironment(data.env)
|
||||||
}, 25)
|
}, 25)
|
||||||
@@ -12382,7 +12434,7 @@ const releaseToConnectLabel = "Release to Connect"
|
|||||||
setSubworkflow(e.target.value);
|
setSubworkflow(e.target.value);
|
||||||
|
|
||||||
// Sets the startnode
|
// Sets the startnode
|
||||||
if (e.target.value.id !== workflow.id) {
|
if (e.target.value.id !== workflow.id && e.target.value.id.length > 0 ) {
|
||||||
console.log("WORKFLOW: ", e.target.value);
|
console.log("WORKFLOW: ", e.target.value);
|
||||||
|
|
||||||
const startnode = e.target.value.actions.find((action) => action.id === e.target.value.start);
|
const startnode = e.target.value.actions.find((action) => action.id === e.target.value.start);
|
||||||
@@ -14808,6 +14860,10 @@ const releaseToConnectLabel = "Release to Connect"
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (workflow.triggers !== undefined && workflow.triggers !== null && workflow.triggers.length > 0 && selectedTriggerIndex >= 0 && selectedTriggerIndex < workflow.triggers.length) {
|
||||||
|
console.log(workflow.triggers[selectedTriggerIndex])
|
||||||
|
}
|
||||||
|
|
||||||
const UserinputSidebar = Object.getOwnPropertyNames(selectedTrigger).length === 0 || workflow.triggers[selectedTriggerIndex] === undefined || selectedTrigger.trigger_type !== "USERINPUT" ? null :
|
const UserinputSidebar = Object.getOwnPropertyNames(selectedTrigger).length === 0 || workflow.triggers[selectedTriggerIndex] === undefined || selectedTrigger.trigger_type !== "USERINPUT" ? null :
|
||||||
<div style={appApiViewStyle}>
|
<div style={appApiViewStyle}>
|
||||||
<h3 style={{ marginBottom: "5px" }}>
|
<h3 style={{ marginBottom: "5px" }}>
|
||||||
@@ -14994,7 +15050,12 @@ const releaseToConnectLabel = "Release to Connect"
|
|||||||
const newname = (option.name.charAt(0).toUpperCase() + option.name.substring(1)).replaceAll("_", " ");
|
const newname = (option.name.charAt(0).toUpperCase() + option.name.substring(1)).replaceAll("_", " ");
|
||||||
return newname;
|
return newname;
|
||||||
}}
|
}}
|
||||||
options={workflows}
|
options={
|
||||||
|
[{
|
||||||
|
"id": "",
|
||||||
|
"name": "No Workflow Selected",
|
||||||
|
}].concat(workflows)
|
||||||
|
}
|
||||||
fullWidth
|
fullWidth
|
||||||
style={{
|
style={{
|
||||||
backgroundColor: theme.palette.inputColor,
|
backgroundColor: theme.palette.inputColor,
|
||||||
@@ -15149,14 +15210,40 @@ const releaseToConnectLabel = "Release to Connect"
|
|||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div style={{marginTop: 20, }} />
|
<div style={{marginTop: 0, }} />
|
||||||
<b>Enabled Input-Questions</b>
|
<b>Enabled Input-Questions</b>
|
||||||
{workflow.input_questions !== undefined && workflow.input_questions !== null && workflow.input_questions.length > 0 ?
|
{workflow.input_questions !== undefined && workflow.input_questions !== null && workflow.input_questions.length > 0 ?
|
||||||
<div>
|
<div>
|
||||||
{workflow.input_questions.map((question, index) => {
|
{workflow.input_questions.map((question, index) => {
|
||||||
|
var foundParamIndex = workflow.triggers[selectedTriggerIndex].parameters.findIndex((param) => param.name === "input_questions")
|
||||||
|
|
||||||
const selectionClick = () => {
|
const selectionClick = () => {
|
||||||
console.log("Clicked input question: ", question)
|
if (foundParamIndex === -1) {
|
||||||
console.log("PARAMS: ", workflow.triggers[selectedTriggerIndex].parameters)
|
workflow.triggers[selectedTriggerIndex].parameters.push({
|
||||||
|
"name": "input_questions",
|
||||||
|
"value": [],
|
||||||
|
})
|
||||||
|
|
||||||
|
foundParamIndex = workflow.triggers[selectedTriggerIndex].parameters.length - 1
|
||||||
|
} else {
|
||||||
|
try {
|
||||||
|
workflow.triggers[selectedTriggerIndex].parameters[foundParamIndex].value = JSON.parse(workflow.triggers[selectedTriggerIndex].parameters[foundParamIndex].value)
|
||||||
|
} catch (e) {
|
||||||
|
console.log("Couldn't parse input questions: ", e)
|
||||||
|
workflow.triggers[selectedTriggerIndex].parameters[foundParamIndex].value = []
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (workflow.triggers[selectedTriggerIndex].parameters[foundParamIndex].value.includes(question.name)) {
|
||||||
|
workflow.triggers[selectedTriggerIndex].parameters[foundParamIndex].value = workflow.triggers[selectedTriggerIndex].parameters[foundParamIndex].value.filter((item) => item !== question.name)
|
||||||
|
} else {
|
||||||
|
workflow.triggers[selectedTriggerIndex].parameters[foundParamIndex].value.push(question.name)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Make it back to a string
|
||||||
|
workflow.triggers[selectedTriggerIndex].parameters[foundParamIndex].value = JSON.stringify(workflow.triggers[selectedTriggerIndex].parameters[foundParamIndex].value)
|
||||||
|
setWorkflow(workflow)
|
||||||
|
setUpdate(Math.random())
|
||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
@@ -15164,7 +15251,7 @@ const releaseToConnectLabel = "Release to Connect"
|
|||||||
selectionClick()
|
selectionClick()
|
||||||
}}>
|
}}>
|
||||||
<Checkbox
|
<Checkbox
|
||||||
checked={false}
|
checked={foundParamIndex !== -1 ? workflow.triggers[selectedTriggerIndex].parameters[foundParamIndex].value.includes(question.name) : false}
|
||||||
/>
|
/>
|
||||||
<Typography variant="body2" style={{marginTop: 10, }}>
|
<Typography variant="body2" style={{marginTop: 10, }}>
|
||||||
{question.name}
|
{question.name}
|
||||||
@@ -15176,6 +15263,7 @@ const releaseToConnectLabel = "Release to Connect"
|
|||||||
:
|
:
|
||||||
<div style={{cursor: "pointer", color: "#f85a3e", marginTop: 10, }} onClick={() => {
|
<div style={{cursor: "pointer", color: "#f85a3e", marginTop: 10, }} onClick={() => {
|
||||||
setEditWorkflowModalOpen(true)
|
setEditWorkflowModalOpen(true)
|
||||||
|
toast.info("Expand and scroll down to add input-questions")
|
||||||
}}>
|
}}>
|
||||||
<Typography variant="body2">No Input-Questions found. Click to add them!</Typography>
|
<Typography variant="body2">No Input-Questions found. Click to add them!</Typography>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -1162,10 +1162,11 @@ const Workflows = (props) => {
|
|||||||
})
|
})
|
||||||
.then((responseJson) => {
|
.then((responseJson) => {
|
||||||
if (responseJson !== undefined) {
|
if (responseJson !== undefined) {
|
||||||
|
|
||||||
var newarray = []
|
var newarray = []
|
||||||
for (var key in responseJson) {
|
for (var wfkey in responseJson) {
|
||||||
const wf = responseJson[key]
|
const wf = responseJson[wfkey]
|
||||||
if (wf.public === true) {
|
if (wf.public === true || wf.hidden === true) {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1178,9 +1179,9 @@ const Workflows = (props) => {
|
|||||||
var parsedactionlist = [];
|
var parsedactionlist = [];
|
||||||
for (var key in newarray) {
|
for (var key in newarray) {
|
||||||
const workflow = newarray[key]
|
const workflow = newarray[key]
|
||||||
if (workflow.status === "production") {
|
//if (workflow.status === "production") {
|
||||||
setProdFilter = true
|
// setProdFilter = true
|
||||||
}
|
//}
|
||||||
|
|
||||||
for (var actionkey in newarray[key].actions) {
|
for (var actionkey in newarray[key].actions) {
|
||||||
const action = newarray[key].actions[actionkey];
|
const action = newarray[key].actions[actionkey];
|
||||||
|
|||||||
Reference in New Issue
Block a user