@@ -2787,9 +2787,6 @@ class AppBase:
|
||||
correct_branches += 1
|
||||
continue
|
||||
|
||||
# FIXME: Check if the previous node has a result or not
|
||||
|
||||
#self.logger.info("[DEBUG] Relevant conditions: %s" % branch["conditions"])
|
||||
successful_conditions = []
|
||||
failed_conditions = []
|
||||
successful_conditions = 0
|
||||
@@ -2802,27 +2799,20 @@ class AppBase:
|
||||
check, sourcevalue, is_loop = parse_params(action, fullexecution, condition["source"], self)
|
||||
if check:
|
||||
continue
|
||||
return False, {"success": False, "reason": "Failed condition: %s %s %s because %s" % (sourcevalue, condition["condition"]["value"], destinationvalue, check)}
|
||||
|
||||
#sourcevalue = sourcevalue.encode("utf-8")
|
||||
sourcevalue = parse_wrapper_start(sourcevalue, self)
|
||||
destinationvalue = condition["destination"]["value"]
|
||||
|
||||
check, destinationvalue, is_loop = parse_params(action, fullexecution, condition["destination"], self)
|
||||
if check:
|
||||
continue
|
||||
return False, {"success": False, "reason": "Failed condition: %s %s %s because %s" % (sourcevalue, condition["condition"]["value"], destinationvalue, check)}
|
||||
|
||||
#destinationvalue = destinationvalue.encode("utf-8")
|
||||
destinationvalue = parse_wrapper_start(destinationvalue, self)
|
||||
|
||||
if not condition["condition"]["value"] in available_checks:
|
||||
self.logger.warning("Skipping %s %s %s because %s is invalid." % (sourcevalue, condition["condition"]["value"], destinationvalue, condition["condition"]["value"]))
|
||||
continue
|
||||
|
||||
#self.logger.info(destinationvalue)
|
||||
# NEGATE
|
||||
|
||||
# Configuration = negated because of WorkflowAppActionParam..
|
||||
validation = run_validation(sourcevalue, condition["condition"]["value"], destinationvalue)
|
||||
try:
|
||||
@@ -2834,12 +2824,6 @@ class AppBase:
|
||||
if validation == True:
|
||||
successful_conditions += 1
|
||||
|
||||
#if not validation:
|
||||
# self.logger.info("Failed condition check for %s %s %s." % (sourcevalue, condition["condition"]["value"], destinationvalue))
|
||||
# return False, {"success": False, "reason": "Failed condition (3): %s %s %s" % (sourcevalue, condition["condition"]["value"], destinationvalue)}
|
||||
|
||||
#self.logger.info("CONDITIONS VS SUCCESS: %d vs %d" % (total_conditions, successful_conditions))
|
||||
|
||||
if total_conditions == successful_conditions:
|
||||
correct_branches += 1
|
||||
|
||||
@@ -2849,15 +2833,9 @@ class AppBase:
|
||||
if matching_branches > 0 and correct_branches > 0:
|
||||
return True, ""
|
||||
|
||||
# FIXME: Check if previous branches are at all finished
|
||||
|
||||
self.logger.info("[DEBUG] Correct branches vs matching branches: %d vs %d" % (correct_branches, matching_branches))
|
||||
return False, {"success": False, "reason": "Minimum of one branch's conditions must be correct to continue. Total: %d of %d" % (correct_branches, matching_branches)}
|
||||
|
||||
#Correct branches vs matching branches: 1 vs 1
|
||||
#if
|
||||
return True, ""
|
||||
|
||||
|
||||
#
|
||||
#
|
||||
|
||||
@@ -36,6 +36,7 @@ import {
|
||||
Divider,
|
||||
Tooltip,
|
||||
Chip,
|
||||
ButtonGroup,
|
||||
} from "@material-ui/core";
|
||||
import { useAlert } from "react-alert";
|
||||
|
||||
@@ -53,7 +54,25 @@ const responsive = {
|
||||
const WelcomeForm = (props) => {
|
||||
const { userdata, globalUrl, discoveryWrapper, setDiscoveryWrapper, appFramework, getFramework, activeStep, setActiveStep, steps, skipped, setSkipped, getApps, apps, handleSetSearch, usecaseButtons, defaultSearch, setDefaultSearch, selectionOpen, setSelectionOpen, } = props
|
||||
|
||||
const usecaseItems = [
|
||||
const [usecaseItems, setUsecaseItems] = useState([
|
||||
{
|
||||
"search": "Phishing",
|
||||
"usecase_search": undefined,
|
||||
},
|
||||
{
|
||||
"search": "Enrichment",
|
||||
"usecase_search": undefined,
|
||||
},
|
||||
{
|
||||
"search": "Enrichment",
|
||||
"usecase_search": "SIEM alert enrichment",
|
||||
},
|
||||
{
|
||||
"search": "Build your own",
|
||||
"usecase_search": undefined,
|
||||
}])
|
||||
|
||||
/*
|
||||
<div style={{minWidth: "95%", maxWidth: "95%", marginLeft: 5, marginRight: 5, }}>
|
||||
<UsecaseSearch
|
||||
globalUrl={globalUrl}
|
||||
@@ -98,7 +117,8 @@ const WelcomeForm = (props) => {
|
||||
userdata={userdata}
|
||||
/>
|
||||
</div>
|
||||
]
|
||||
])
|
||||
*/
|
||||
|
||||
const [discoveryData, setDiscoveryData] = React.useState({})
|
||||
const [name, setName] = React.useState("")
|
||||
@@ -166,6 +186,43 @@ const WelcomeForm = (props) => {
|
||||
} else {
|
||||
//navigate(`/welcome?tab=1`)
|
||||
}
|
||||
|
||||
const foundTemplate = params["workflow_template"];
|
||||
if (foundTemplate !== null && foundTemplate !== undefined) {
|
||||
console.log("Found workflow template: ", foundTemplate)
|
||||
|
||||
var sourceapp = undefined
|
||||
var destinationapp = undefined
|
||||
var action = undefined
|
||||
const srcapp = params["source_app"];
|
||||
if (srcapp !== null && srcapp !== undefined) {
|
||||
sourceapp = srcapp
|
||||
}
|
||||
|
||||
const dstapp = params["dest_app"];
|
||||
if (dstapp !== null && dstapp !== undefined) {
|
||||
destinationapp = dstapp
|
||||
}
|
||||
|
||||
const act = params["action"];
|
||||
if (act !== null && act !== undefined) {
|
||||
action = act
|
||||
}
|
||||
|
||||
//defaultSearch={foundTemplate}
|
||||
//
|
||||
usecaseItems[0] = {
|
||||
"search": "enrichment",
|
||||
"usecase_search": foundTemplate,
|
||||
"sourceapp": sourceapp,
|
||||
"destinationapp": destinationapp,
|
||||
"autotry": action === "try",
|
||||
}
|
||||
|
||||
console.log("Adding: ", usecaseItems[0])
|
||||
|
||||
setUsecaseItems(usecaseItems)
|
||||
}
|
||||
}
|
||||
}, [])
|
||||
|
||||
@@ -416,7 +473,27 @@ const WelcomeForm = (props) => {
|
||||
minWidth: buttonWidth,
|
||||
maxWidth: buttonWidth,
|
||||
}
|
||||
|
||||
|
||||
|
||||
const formattedCarousel = appFramework === undefined || appFramework === null ? [] : usecaseItems.map((item, index) => {
|
||||
return (
|
||||
<div style={{minWidth: "95%", maxWidth: "95%", marginLeft: 5, marginRight: 5, }}>
|
||||
<UsecaseSearch
|
||||
globalUrl={globalUrl}
|
||||
defaultSearch={item.search}
|
||||
usecaseSearch={item.usecase_search}
|
||||
appFramework={appFramework}
|
||||
apps={apps}
|
||||
getFramework={getFramework}
|
||||
userdata={userdata}
|
||||
autotry={item.autotry}
|
||||
sourceapp={item.sourceapp}
|
||||
destinationapp={item.destinationapp}
|
||||
/>
|
||||
</div>
|
||||
)
|
||||
})
|
||||
|
||||
const getStepContent = (step) => {
|
||||
switch (step) {
|
||||
case 0:
|
||||
@@ -676,10 +753,10 @@ const WelcomeForm = (props) => {
|
||||
<div style={{minWidth: 554, maxWidth: 554, borderRadius: theme.palette.borderRadius, padding: 25, }}>
|
||||
<AliceCarousel
|
||||
style={{ backgroundColor: theme.palette.surfaceColor, minHeight: 750, maxHeight: 750, }}
|
||||
items={usecaseItems}
|
||||
items={formattedCarousel}
|
||||
activeIndex={thumbIndex}
|
||||
infiniteLoop
|
||||
mouseTracking
|
||||
mouseTracking={false}
|
||||
responsive={responsive}
|
||||
// activeIndex={activeIndex}
|
||||
controlsStrategy="responsive"
|
||||
@@ -688,7 +765,6 @@ const WelcomeForm = (props) => {
|
||||
animationType="fadeout"
|
||||
animationDuration={800}
|
||||
disableButtonsControls
|
||||
disableDotsControls
|
||||
|
||||
/>
|
||||
</div>
|
||||
@@ -721,6 +797,7 @@ const WelcomeForm = (props) => {
|
||||
}
|
||||
}
|
||||
|
||||
const extraHeight = isCloud ? -7 : 0
|
||||
return (
|
||||
<div style={{}}>
|
||||
{/*selectionOpen ?
|
||||
@@ -756,7 +833,7 @@ const WelcomeForm = (props) => {
|
||||
disabled={activeStep === 0}
|
||||
onClick={handleBack}
|
||||
variant={"outlined"}
|
||||
style={{marginLeft: 10, height: 64, width: 100, position: "absolute", top: activeStep === 1 ? -600 : -577, left: activeStep === 1 ? 105 : -145+clickdiff, }}
|
||||
style={{marginLeft: 10, height: 64, width: 100, position: "absolute", top: activeStep === 1 ? -600-extraHeight : -577, left: activeStep === 1 ? 105 : -145+clickdiff, borderRadius: "50px 0px 0px 50px", }}
|
||||
>
|
||||
Back
|
||||
</Button>
|
||||
@@ -764,7 +841,7 @@ const WelcomeForm = (props) => {
|
||||
variant={"outlined"}
|
||||
color="primary"
|
||||
onClick={handleNext}
|
||||
style={{marginLeft: 10, height: 64, width: 100, position: "absolute", top: activeStep === 1 ? -600: -577, left: activeStep === 1 ? 748 : 510+clickdiff, }}
|
||||
style={{marginLeft: 10, height: 64, width: 100, position: "absolute", top: activeStep === 1 ? -600-extraHeight: -577, left: activeStep === 1 ? 748 : 510+clickdiff, borderRadius: "0px 50px 50px 0px", }}
|
||||
disabled={activeStep === 0 ? orgName.length === 0 || name.length === 0 : false}
|
||||
>
|
||||
{activeStep === steps.length - 1 ? "Finish" : "Next"}
|
||||
|
||||
Reference in New Issue
Block a user