Added single app testing from GUI

This commit is contained in:
frikky
2021-06-02 23:39:20 +02:00
parent 2c9bac9eb0
commit 24fd96fcf0
10 changed files with 83 additions and 58 deletions
+11 -10
View File
@@ -154,7 +154,7 @@ const Admin = (props) => {
// Need to wait because query in ES is too fast
setTimeout(() => {
getAppAuthentication()
}, 1000)
}, 500)
alert.success("Successfully deleted authentication!")
}
}),
@@ -228,7 +228,7 @@ const Admin = (props) => {
.then((responseJson) => {
setTimeout(() => {
handleGetOrg(org_id)
}, 1000)
}, 500)
})
.catch(error => {
alert.error("Err: " + error.toString())
@@ -264,12 +264,13 @@ const Admin = (props) => {
console.log("Cloud sync fail?")
}
setTimeout(() => {
return response.json()
}, 1000)
return response.json()
//setTimeout(() => {
//}, 1000)
})
.then((responseJson) => {
if (!responseJson.success && responseJson.reason !== undefined) {
console.log("RESP: ", responseJson)
if (responseJson.success === false && responseJson.reason !== undefined) {
setOrgSyncResponse(responseJson.reason)
alert.error("Failed to handle sync: "+responseJson.reason)
} else if (!responseJson.success) {
@@ -355,7 +356,7 @@ const Admin = (props) => {
setSelectedUserModalOpen(false)
setTimeout(() => {
getAppAuthentication()
}, 1000)
}, 500)
}
}),
)
@@ -513,7 +514,7 @@ const Admin = (props) => {
setModalOpen(false)
setTimeout(() => {
getUsers()
}, 1000)
}, 500)
}
}),
)
@@ -548,7 +549,7 @@ const Admin = (props) => {
setModalOpen(false)
setTimeout(() => {
getUsers()
}, 1000)
}, 500)
}
}),
)
@@ -1649,7 +1650,7 @@ const Admin = (props) => {
</div>
{orgSyncResponse.length > 0 ?
<Typography style={{marginTop: 5, marginBottom: 10}}>
Message from Shuffle: <b>{orgSyncResponse}</b>
Message from Shuffle Cloud: <b>{orgSyncResponse}</b>
</Typography>
: null
}
+11 -11
View File
@@ -1571,17 +1571,13 @@ const AngularWorkflow = (props) => {
}
}
console.log("ID ETC: ", idnumber, paramname)
if (idnumber >= 0 && paramname.length > 0) {
const exampledata = GetExampleResult(nodedata)
const parsedname = paramname.toLowerCase().trim().replaceAll("_", " ")
console.log("EX: ", exampledata)
console.log("NAME: ", parsedname)
const foundresult = GetParamMatch(parsedname, exampledata, "")
console.log("RESULT: ", foundresult)
if (foundresult.length > 0) {
console.log("FOUND: ", paramname, foundresult)
console.log("FOUND RESULT: ", paramname, foundresult)
newValue = `${newValue}${foundresult}`
}
@@ -2100,9 +2096,13 @@ const AngularWorkflow = (props) => {
return ""
}
if (exampledata === null) {
return ""
}
// Basically just a stupid if-else :)
const synonyms = {
"id": ["id", "ref", "sourceref", "reference", "sourcereference", "alert id", "case id", "incident id", "service id",],
"id": ["id", "ref", "sourceref", "reference", "sourcereference", "alert id", "case id", "incident id", "service id", "sid", "uid", "uuid"],
"title": ["title", "name", "message"],
"description": ["description", "explanation", "story", "details",],
"email": ["mail", "email", "sender", "receiver", "recipient"],
@@ -7535,7 +7535,7 @@ const AngularWorkflow = (props) => {
/* Copy the text inside the text field */
document.execCommand("copy")
alert.success("Copied data")
//alert.success("Copied data")
} else {
console.log("Failed to copy from "+elementName+": ", copyText)
}
@@ -7544,7 +7544,7 @@ const AngularWorkflow = (props) => {
const HandleJsonCopy = (base, copy, base_node_name) => {
console.log("COPY: ", copy)
var newitem = JSON.parse(base)
to_be_copied = "$"+base_node_name
to_be_copied = "$"+base_node_name.toLowerCase().replaceAll(" ", "_")
for (var key in copy.namespace) {
if (copy.namespace[key].includes("Results for")) {
continue
@@ -7591,7 +7591,7 @@ const AngularWorkflow = (props) => {
/* Copy the text inside the text field */
document.execCommand("copy");
alert.success("Copied "+to_be_copied)
//alert.success("Copied "+to_be_copied)
console.log("COPYING!")
} else {
console.log("Couldn't find element ", elementName)
@@ -8097,7 +8097,7 @@ const AngularWorkflow = (props) => {
{validate.valid ? <ReactJson
src={validate.result}
theme="solarized"
collapsed={false}
collapsed={selectedResult.result.length < 10000 ? false : true}
displayDataTypes={false}
enableClipboard={(copy) => {
handleReactJsonClipboard(copy)
@@ -8131,7 +8131,7 @@ const AngularWorkflow = (props) => {
/* Copy the text inside the text field */
document.execCommand("copy");
alert.success("Copied "+to_be_copied)
//alert.success("Copied "+to_be_copied)
} else {
console.log("Failed to copy. copy_element_shuffle is undefined")
}
+4 -3
View File
@@ -2443,7 +2443,7 @@ const AppCreator = (props) => {
version: selectedAction.app_version,
})
const [requiresAuthentication, setRequiresAuthentication] = useState(app.authentication.required && app.authentication.parameters !== undefined && app.authentication.parameters !== null)
const [requiresAuthentication, setRequiresAuthentication] = useState(app.authentication !== null && app.authentication !== undefined && app.authentication.required && app.authentication.parameters !== undefined && app.authentication.parameters !== null ? true : false)
const [workflow, setWorkflow] = useState({
name: "",
description: "",
@@ -2699,7 +2699,7 @@ const AppCreator = (props) => {
for (var key in selectedApp.authentication.parameters) {
if (authenticationOption.fields[selectedApp.authentication.parameters[key].name].length === 0) {
alert.info("Field "+selectedApp.authentication.parameters[key].name+" can't be empty")
return
return null
}
}
@@ -2744,6 +2744,7 @@ const AppCreator = (props) => {
authenticationOption.label = selectedApp.name+" authentication"
}
console.log("PRE RETURN")
return (
<div>
<DialogContent>
@@ -3032,7 +3033,7 @@ const AppCreator = (props) => {
Continue
</Button>
</DialogActions>
<ParsedActionHandler />
{/*<ParsedActionHandler />*/}
</FormControl>
</Dialog>
: null;
+4 -2
View File
@@ -531,7 +531,7 @@ const Workflows = (props) => {
deleteWorkflow(selectedWorkflowId)
setTimeout(() => {
getAvailableWorkflows()
}, 1000)
}, 500)
}
setDeleteModalOpen(false)
}} color="primary">
@@ -1489,7 +1489,9 @@ const Workflows = (props) => {
window.location.pathname = "/workflows/"+responseJson["id"]
} else if (!redirect) {
// Update :)
getAvailableWorkflows()
setTimeout(() => {
getAvailableWorkflows()
}, 500)
setImportLoading(false)
} else {
alert.info("Successfully changed basic info for workflow")