Fixed usecase merging to go through cloud
This commit is contained in:
@@ -786,7 +786,9 @@ const UsecaseSearch = (props) => {
|
||||
}
|
||||
|
||||
const mergeWorkflowUsecases = (usecasedata) => {
|
||||
const url = `${globalUrl}/api/v1/workflows/merge`;
|
||||
//const url = `${globalUrl}/api/v1/workflows/merge`;
|
||||
//const url = `https://0360-178-232-150-183.ngrok.io/api/v1/workflows/merge`;
|
||||
const url = `https://shuffler.io/api/v1/workflows/merge`;
|
||||
fetch(url, {
|
||||
mode: "cors",
|
||||
method: "POST",
|
||||
@@ -802,76 +804,85 @@ const UsecaseSearch = (props) => {
|
||||
response.json().then((responseJson) => {
|
||||
setIsUploading(false)
|
||||
var changed = false
|
||||
if (responseJson.success === false) {
|
||||
if (responseJson.reason !== null && responseJson.reason !== undefined) {
|
||||
//alert.error(responseJson.reason)
|
||||
}
|
||||
|
||||
if (responseJson.source === "") {
|
||||
const appname =
|
||||
usecasedata.source.error = usecasedata.source.app_name === undefined ? "Select a Trigger workflow first" : `${usecasedata.source.app_name} has no public trigger workflow yet. Click this to try another app`
|
||||
changed = true
|
||||
if (responseJson.success === false) {
|
||||
if (responseJson.reason !== null && responseJson.reason !== undefined) {
|
||||
//alert.error(responseJson.reason)
|
||||
}
|
||||
|
||||
if (responseJson.source === "") {
|
||||
const appname =
|
||||
usecasedata.source.error = usecasedata.source.app_name === undefined ? "Select a Trigger workflow first" : `${usecasedata.source.app_name} has no public trigger workflow yet. Click this to try another app`
|
||||
changed = true
|
||||
} else {
|
||||
usecasedata.source.error = ""
|
||||
changed = true
|
||||
}
|
||||
|
||||
if (responseJson.destination === "") {
|
||||
usecasedata.destination.error = usecasedata.destination.app_name === undefined ? "Select a Subflow first" : `${usecasedata.destination.app_name} has no public subflow yet. Click this to try another app`
|
||||
changed = true
|
||||
} else {
|
||||
usecasedata.source.error = ""
|
||||
usecasedata.destination.error = ""
|
||||
changed = true
|
||||
}
|
||||
|
||||
if (responseJson.destination === "") {
|
||||
usecasedata.destination.error = usecasedata.destination.app_name === undefined ? "Select a Subflow first" : `${usecasedata.destination.app_name} has no public subflow yet. Click this to try another app`
|
||||
changed = true
|
||||
} else {
|
||||
usecasedata.destination.error = ""
|
||||
changed = true
|
||||
}
|
||||
if (responseJson.middle !== undefined) {
|
||||
for (var key in responseJson.middle) {
|
||||
for (var subkey in usecasedata.middle) {
|
||||
if (responseJson.middle[key] === usecasedata.middle[key].text) {
|
||||
console.log("Found: ")
|
||||
if (usecasedata.middle[subkey].app_name === undefined || usecasedata.middle[subkey].app_name === "") {
|
||||
usecasedata.middle[subkey].error = `${usecasedata.middle[subkey].type} app must be selected first. Click this to change`
|
||||
} else {
|
||||
usecasedata.middle[subkey].error = `${usecasedata.middle[subkey].app_name} has no public subflow yet. Click this to change`
|
||||
}
|
||||
|
||||
if (responseJson.middle !== undefined) {
|
||||
for (var key in responseJson.middle) {
|
||||
for (var subkey in usecasedata.middle) {
|
||||
if (responseJson.middle[key] === usecasedata.middle[key].text) {
|
||||
console.log("Found: ")
|
||||
if (usecasedata.middle[subkey].app_name === undefined || usecasedata.middle[subkey].app_name === "") {
|
||||
usecasedata.middle[subkey].error = `${usecasedata.middle[subkey].type} app must be selected first. Click this to change`
|
||||
} else {
|
||||
usecasedata.middle[subkey].error = `${usecasedata.middle[subkey].app_name} has no public subflow yet. Click this to change`
|
||||
changed = true
|
||||
break
|
||||
}
|
||||
|
||||
changed = true
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (responseJson.workflow_id !== null && responseJson.workflow_id !== undefined) {
|
||||
if (responseJson.added_auth !== undefined && responseJson.added_auth !== null && responseJson.added_auth.length > 0) {
|
||||
console.log("SHOULD HANDLE AUTH: ", responseJson.added_auth)
|
||||
setConfigureWorkflowAuth(responseJson.added_auth)
|
||||
|
||||
if (setFoundWorkflowId !== undefined) {
|
||||
console.log("Set found workflow id: ", responseJson.workflow_id)
|
||||
setFoundWorkflowId(responseJson.workflow_id)
|
||||
} else {
|
||||
if (!isCloud) {
|
||||
console.log("Not cloud!")
|
||||
setFoundWorkflowId(responseJson.id)
|
||||
setWorkflow(responseJson)
|
||||
} else if (isCloud) {
|
||||
if (responseJson.workflow_id !== null && responseJson.workflow_id !== undefined) {
|
||||
if (responseJson.added_auth !== undefined && responseJson.added_auth !== null && responseJson.added_auth.length > 0) {
|
||||
console.log("SHOULD HANDLE AUTH: ", responseJson.added_auth)
|
||||
setConfigureWorkflowAuth(responseJson.added_auth)
|
||||
|
||||
if (setFoundWorkflowId !== undefined) {
|
||||
console.log("Set found workflow id: ", responseJson.workflow_id)
|
||||
setFoundWorkflowId(responseJson.workflow_id)
|
||||
}
|
||||
|
||||
getWorkflow(responseJson.workflow_id)
|
||||
getAppAuthentication()
|
||||
} else {
|
||||
if (setFoundWorkflowId !== undefined) {
|
||||
console.log("Set found workflow id: ", responseJson.workflow_id)
|
||||
setFoundWorkflowId(responseJson.workflow_id)
|
||||
}
|
||||
|
||||
setWorkflow({"id": responseJson.workflow_id})
|
||||
}
|
||||
}
|
||||
|
||||
getWorkflow(responseJson.workflow_id)
|
||||
getAppAuthentication()
|
||||
} else {
|
||||
if (setFoundWorkflowId !== undefined) {
|
||||
console.log("Set found workflow id: ", responseJson.workflow_id)
|
||||
setFoundWorkflowId(responseJson.workflow_id)
|
||||
if (responseJson.auth_required === true) {
|
||||
console.log("SET AUTH AS NEXT STEP!")
|
||||
}
|
||||
|
||||
setWorkflow({"id": responseJson.workflow_id})
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
if (responseJson.auth_required === true) {
|
||||
console.log("SET AUTH AS NEXT STEP!")
|
||||
|
||||
if (changed === true) {
|
||||
setAllUsecases([usecasedata])
|
||||
}
|
||||
}
|
||||
|
||||
if (changed === true) {
|
||||
setAllUsecases([usecasedata])
|
||||
}
|
||||
})
|
||||
)
|
||||
.catch((error) => {
|
||||
|
||||
@@ -162,7 +162,6 @@ const WelcomeForm = (props) => {
|
||||
if (foundTab !== null && foundTab !== undefined && !isNaN(foundTab)) {
|
||||
if (foundTab === 3 || foundTab === "3") {
|
||||
console.log("SET SEARCH!!")
|
||||
//setclickdiff(240)
|
||||
}
|
||||
} else {
|
||||
//navigate(`/welcome?tab=1`)
|
||||
@@ -298,7 +297,7 @@ const WelcomeForm = (props) => {
|
||||
|
||||
if (activeStep === 0) {
|
||||
console.log("Should send basic information about org (fetch)")
|
||||
setclickdiff(0)
|
||||
setclickdiff(240)
|
||||
navigate(`/welcome?tab=2`)
|
||||
|
||||
if (isCloud) {
|
||||
@@ -321,8 +320,6 @@ const WelcomeForm = (props) => {
|
||||
console.log("Should send secondary info about apps and other things")
|
||||
setDiscoveryWrapper({})
|
||||
|
||||
setclickdiff(240)
|
||||
//setclickdiff(0)
|
||||
navigate(`/welcome?tab=3`)
|
||||
//handleSetSearch("Enrichment", "2. Enrich")
|
||||
handleSetSearch(usecaseButtons[0].name, usecaseButtons[0].usecase)
|
||||
@@ -356,10 +353,8 @@ const WelcomeForm = (props) => {
|
||||
if (getFramework !== undefined) {
|
||||
getFramework()
|
||||
}
|
||||
setclickdiff(0)
|
||||
navigate("/welcome?tab=2")
|
||||
} else if (activeStep === 1) {
|
||||
//setclickdiff(0)
|
||||
navigate("/welcome?tab=1")
|
||||
}
|
||||
};
|
||||
@@ -376,6 +371,7 @@ const WelcomeForm = (props) => {
|
||||
return newSkipped;
|
||||
});
|
||||
};
|
||||
|
||||
const handleReset = () => {
|
||||
setActiveStep(0);
|
||||
};
|
||||
@@ -384,6 +380,7 @@ const WelcomeForm = (props) => {
|
||||
console.log("Selected app changed (effect)")
|
||||
}, [newSelectedApp])
|
||||
|
||||
console.log("Clickdiff: ", clickdiff)
|
||||
|
||||
//const buttonWidth = 145
|
||||
const buttonWidth = 450
|
||||
@@ -434,7 +431,7 @@ const WelcomeForm = (props) => {
|
||||
</Typography>
|
||||
*/}
|
||||
<Typography variant="body1" style={{marginLeft: 8, marginTop: 10, marginRight: 30, }} color="textSecondary">
|
||||
First, we need some more information in order to understand how we best can help you find relevant Usecases. This is optional, but highly encouraged.
|
||||
In order to understand how we best can help you find relevant Usecases, please provide the information below. This is optional, but highly encouraged.
|
||||
</Typography>
|
||||
<Grid item xs={11} style={{marginTop: 16, padding: 0,}}>
|
||||
<TextField
|
||||
@@ -761,7 +758,7 @@ const WelcomeForm = (props) => {
|
||||
disabled={activeStep === 0}
|
||||
onClick={handleBack}
|
||||
variant={"outlined"}
|
||||
style={{marginLeft: 10, height: 64, width: 100, position: "absolute", top: activeStep === 1 ? -594 : -577, left: activeStep === 1 ? 105+clickdiff : -145+clickdiff, }}
|
||||
style={{marginLeft: 10, height: 64, width: 100, position: "absolute", top: activeStep === 1 ? -600 : -577, left: activeStep === 1 ? 105 : -145+clickdiff, }}
|
||||
>
|
||||
Back
|
||||
</Button>
|
||||
@@ -769,7 +766,7 @@ const WelcomeForm = (props) => {
|
||||
variant={"outlined"}
|
||||
color="primary"
|
||||
onClick={handleNext}
|
||||
style={{marginLeft: 10, height: 64, width: 100, position: "absolute", top: activeStep === 1 ? -594 : -577, left: activeStep === 1 ? 758+clickdiff : 510+clickdiff, }}
|
||||
style={{marginLeft: 10, height: 64, width: 100, position: "absolute", top: activeStep === 1 ? -600: -577, left: activeStep === 1 ? 748 : 510+clickdiff, }}
|
||||
disabled={activeStep === 0 ? orgName.length === 0 || name.length === 0 : false}
|
||||
>
|
||||
{activeStep === steps.length - 1 ? "Finish" : "Next"}
|
||||
@@ -804,7 +801,8 @@ const WelcomeForm = (props) => {
|
||||
color="secondary"
|
||||
onClick={() => {
|
||||
console.log("Skip!")
|
||||
|
||||
|
||||
setclickdiff(240)
|
||||
if (isCloud) {
|
||||
ReactGA.event({
|
||||
category: "welcome",
|
||||
|
||||
Reference in New Issue
Block a user