Re-fixed looping issues in #1012 and bugs from the issue that the initial fix caused
This commit is contained in:
@@ -564,6 +564,7 @@ const AppFramework = (props) => {
|
||||
|
||||
const alert = useAlert()
|
||||
|
||||
|
||||
const handleLoadNextSuggestion = (frameworkData) => {
|
||||
console.log("Should check for next apps to load from App suggestion model")
|
||||
//fetch(globalUrl + "/api/v1/workflows/usecases", {
|
||||
@@ -623,7 +624,6 @@ const AppFramework = (props) => {
|
||||
suggestions.push(value.slice(0,1))
|
||||
}
|
||||
|
||||
console.log("SUGG: ", suggestions)
|
||||
setInjectedApps(suggestions)
|
||||
})
|
||||
.catch((error) => {
|
||||
@@ -909,6 +909,10 @@ const AppFramework = (props) => {
|
||||
})
|
||||
}
|
||||
|
||||
useEffect(() => {
|
||||
handleLoadNextSuggestion(frameworkData)
|
||||
}, [])
|
||||
|
||||
useEffect(() => {
|
||||
console.log("New selected app: ", newSelectedApp, discoveryData)
|
||||
if (newSelectedApp.objectID === undefined || newSelectedApp.objectID === undefined || newSelectedApp.objectID.length === 0) {
|
||||
@@ -1931,10 +1935,11 @@ const AppFramework = (props) => {
|
||||
|
||||
return (
|
||||
<div style={{display: "flex", position: "absolute", top: categoryTop, left: categoryLeft, zIndex: 10010, }}>
|
||||
{apps.map((app) => {
|
||||
{apps.map((app, appIndex) => {
|
||||
return (
|
||||
<Chip
|
||||
avatar={<Avatar alt={app.name} src={app.image_url} style={{backgroundColor: "white", }} />}
|
||||
key={app.id}
|
||||
label={""}
|
||||
variant="contained"
|
||||
style={{}}
|
||||
@@ -2089,6 +2094,9 @@ const AppFramework = (props) => {
|
||||
|
||||
setSelectionOpen(true)
|
||||
setDefaultSearch("")
|
||||
|
||||
//handleLoadNextSuggestion(frameworkData)
|
||||
setInjectedApps([])
|
||||
|
||||
const foundelement = cy.getElementById(discoveryData.id)
|
||||
if (foundelement !== undefined && foundelement !== null) {
|
||||
|
||||
@@ -129,7 +129,7 @@ const ConfigureWorkflow = (props) => {
|
||||
|
||||
setFirstLoad(workflow.id)
|
||||
const newactions = [];
|
||||
for (let [key, keyval] in workflow.actions.entries()) {
|
||||
for (let [key, keyval] in Object.entries(workflow.actions)) {
|
||||
const action = workflow.actions[key];
|
||||
var newaction = {
|
||||
large_image: action.large_image,
|
||||
@@ -175,7 +175,7 @@ const ConfigureWorkflow = (props) => {
|
||||
) {
|
||||
// Check if configuration is filled or not
|
||||
var filled = true;
|
||||
for (let [key,keyval] in action.parameters.entries()) {
|
||||
for (let [key,keyval] in Object.entries(action.parameters)) {
|
||||
if (action.parameters[key].configuration) {
|
||||
//console.log("Found config: ", action.parameters[key])
|
||||
if (
|
||||
@@ -216,7 +216,7 @@ const ConfigureWorkflow = (props) => {
|
||||
|
||||
if (newaction.must_authenticate) {
|
||||
var authenticationOptions = [];
|
||||
for (let [key,keyval] in appAuthentication.entries()) {
|
||||
for (let [key,keyval] in Object.entries(appAuthentication)) {
|
||||
const auth = appAuthentication[key];
|
||||
if (auth.app.name === app.name && auth.active) {
|
||||
//console.log("Found auth: ", auth)
|
||||
@@ -265,7 +265,7 @@ const ConfigureWorkflow = (props) => {
|
||||
}
|
||||
|
||||
if (workflow.workflow_variables !== undefined && workflow.workflow_variables !== null && workflow.workflow_variables.length !== 0) {
|
||||
for (let [key,keyval] in workflow.workflow_variables.entries()) {
|
||||
for (let [key,keyval] in Object.entries(workflow.workflow_variables)) {
|
||||
const variable = workflow.workflow_variables[key];
|
||||
if (
|
||||
variable.value === undefined ||
|
||||
@@ -280,7 +280,7 @@ const ConfigureWorkflow = (props) => {
|
||||
}
|
||||
|
||||
if (workflow.triggers !== undefined && workflow.triggers !== null && workflow.triggers.length !== 0) {
|
||||
for (let [key,keyval] in workflow.triggers.entries()) {
|
||||
for (let [key,keyval] in Object.entries(workflow.triggers)) {
|
||||
var trigger = workflow.triggers[key];
|
||||
trigger.index = key;
|
||||
|
||||
@@ -302,7 +302,7 @@ const ConfigureWorkflow = (props) => {
|
||||
}
|
||||
]
|
||||
|
||||
for (let [subkey,subkeyval] in tmpsteps.entries()) {
|
||||
for (let [subkey,subkeyval] in Object.entries(tmpsteps)) {
|
||||
newactions[foundindex].steps.push(tmpsteps[subkey])
|
||||
}
|
||||
|
||||
@@ -344,13 +344,13 @@ const ConfigureWorkflow = (props) => {
|
||||
setRequiredActions(newactions);
|
||||
}
|
||||
|
||||
if (appAuthentication.length !== previousAuth.length) {
|
||||
if (appAuthentication !== undefined && previousAuth !== undefined && appAuthentication.length !== previousAuth.length) {
|
||||
var newactions = []
|
||||
for (let [actionkey, actionkeyval] in requiredActions.entries()) {
|
||||
for (let [actionkey, actionkeyval] in Object.entries(requiredActions)) {
|
||||
var newaction = requiredActions[actionkey];
|
||||
const app = newaction.app;
|
||||
|
||||
for (let [key,keyval] in appAuthentication.entries()) {
|
||||
for (let [key,keyval] in Object.entries(appAuthentication)) {
|
||||
const auth = appAuthentication[key];
|
||||
|
||||
// Does this account for all the different ones of the same?
|
||||
@@ -694,7 +694,7 @@ const ConfigureWorkflow = (props) => {
|
||||
if (workflow.actions !== null) {
|
||||
//console.log(workflow.actions)
|
||||
alert.info("Setting action to version "+action.update_version)
|
||||
for (let [key,keyval] in workflow.actions.entries()) {
|
||||
for (let [key,keyval] in Object.entries(workflow.actions)) {
|
||||
if (workflow.actions[key].app_name === action.app_name && workflow.actions[key].app_version === action.app_version) {
|
||||
workflow.actions[key].app_version = action.update_version
|
||||
|
||||
|
||||
@@ -277,7 +277,7 @@ const ParsedAction = (props) => {
|
||||
console.log("FOUNDACTION: ", foundAction);
|
||||
if (foundAction !== null && foundAction !== undefined) {
|
||||
var foundparams = [];
|
||||
for (let [paramkey,paramkeyval] in foundAction.parameters.entries()) {
|
||||
for (let [paramkey,paramkeyval] in Object.entries(foundAction.parameters)) {
|
||||
const param = foundAction.parameters[paramkey];
|
||||
|
||||
const foundParam = selectedAction.parameters.find(
|
||||
@@ -401,7 +401,7 @@ const ParsedAction = (props) => {
|
||||
if (actionlist.length === 0) {
|
||||
// FIXME: Have previous execution values in here
|
||||
if (workflowExecutions.length > 0) {
|
||||
for (let [key,keyval] in workflowExecutions.entries()) {
|
||||
for (let [key,keyval] in Object.entries(workflowExecutions)) {
|
||||
if (
|
||||
workflowExecutions[key].execution_argument === undefined ||
|
||||
workflowExecutions[key].execution_argument === null ||
|
||||
@@ -451,7 +451,7 @@ const ParsedAction = (props) => {
|
||||
workflow.workflow_variables !== undefined &&
|
||||
workflow.workflow_variables.length > 0
|
||||
) {
|
||||
for (let [key,keyval] in workflow.workflow_variables.entries()) {
|
||||
for (let [key,keyval] in Object.entries(workflow.workflow_variables)) {
|
||||
const item = workflow.workflow_variables[key];
|
||||
actionlist.push({
|
||||
type: "workflow_variable",
|
||||
@@ -470,7 +470,7 @@ const ParsedAction = (props) => {
|
||||
workflow.execution_variables !== undefined &&
|
||||
workflow.execution_variables.length > 0
|
||||
) {
|
||||
for (let [key,keyval] in workflow.execution_variables.entries()) {
|
||||
for (let [key,keyval] in Object.entries(workflow.execution_variables)) {
|
||||
const item = workflow.execution_variables[key];
|
||||
actionlist.push({
|
||||
type: "execution_variable",
|
||||
@@ -488,7 +488,7 @@ const ParsedAction = (props) => {
|
||||
var parents = getParents(selectedAction);
|
||||
|
||||
if (parents.length > 1) {
|
||||
for (let [key,keyval] in parents.entries()) {
|
||||
for (let [key,keyval] in Object.entries(parents)) {
|
||||
const item = parents[key];
|
||||
if (item.label === "Execution Argument") {
|
||||
continue;
|
||||
@@ -500,7 +500,7 @@ const ParsedAction = (props) => {
|
||||
if (workflowExecutions.length > 0) {
|
||||
// Look for the ID
|
||||
const found = false;
|
||||
for (let [key,keyval] in workflowExecutions.entries()) {
|
||||
for (let [key,keyval] in Object.entries(workflowExecutions)) {
|
||||
if (
|
||||
workflowExecutions[key].results === undefined ||
|
||||
workflowExecutions[key].results === null
|
||||
@@ -566,13 +566,12 @@ const ParsedAction = (props) => {
|
||||
|
||||
if (found !== null && found !== undefined) {
|
||||
var new_occurences = []
|
||||
for (let [key,keyval] in found.entries()) {
|
||||
for (let [key,keyval] in Object.entries(found)) {
|
||||
if (found[key][0] !== "\\") {
|
||||
new_occurences.push(found[key])
|
||||
}
|
||||
}
|
||||
|
||||
console.log("New found: ", new_occurences)
|
||||
found = new_occurences.valueOf()
|
||||
}
|
||||
|
||||
@@ -627,9 +626,8 @@ const ParsedAction = (props) => {
|
||||
//console.log("Action change: ", selectedAction, data)
|
||||
if (data.name.startsWith("${") && data.name.endsWith("}")) {
|
||||
// PARAM FIX - Gonna use the ID field, even though it's a hack
|
||||
const paramcheck = selectedAction.parameters.find(
|
||||
(param) => param.name === "body"
|
||||
);
|
||||
const paramcheck = selectedAction.parameters.find((param) => param.name === "body");
|
||||
|
||||
if (paramcheck !== undefined) {
|
||||
// Escapes all double quotes
|
||||
var toReplace = event.target.value.trim()
|
||||
@@ -730,7 +728,7 @@ const ParsedAction = (props) => {
|
||||
|
||||
var curstring = "";
|
||||
var record = false;
|
||||
for (let [key,keyval] in selectedActionParameters[count].value.entries()) {
|
||||
for (let [key,keyval] in Object.entries(selectedActionParameters[count].value)) {
|
||||
const item = selectedActionParameters[count].value[key];
|
||||
if (record) {
|
||||
curstring += item;
|
||||
@@ -911,7 +909,7 @@ const ParsedAction = (props) => {
|
||||
|
||||
var curstring = ""
|
||||
var record = false
|
||||
for (let [key,keyval] in selectedActionParameters[count].value.entries()) {
|
||||
for (let [key,keyval] in Object.entries(selectedActionParameters[count].value)) {
|
||||
const item = selectedActionParameters[count].value[key]
|
||||
if (record) {
|
||||
curstring += item
|
||||
@@ -1187,7 +1185,7 @@ const ParsedAction = (props) => {
|
||||
renderInput={(params) => {
|
||||
if (params.inputProps !== undefined && params.inputProps !== null && params.inputProps.value !== undefined && params.inputProps.value !== null) {
|
||||
const prefixes = ["Post", "Put", "Patch"]
|
||||
for (let [key,keyval] in prefixes.entries()) {
|
||||
for (let [key,keyval] in Object.entries(prefixes)) {
|
||||
if (params.inputProps.value.startsWith(prefixes[key])) {
|
||||
params.inputProps.value = params.inputProps.value.replace(prefixes[key]+" ", "", -1)
|
||||
if (params.inputProps.value.length > 1) {
|
||||
@@ -1346,9 +1344,8 @@ const ParsedAction = (props) => {
|
||||
}
|
||||
|
||||
if (data.name.startsWith("${") && data.name.endsWith("}")) {
|
||||
const paramcheck = selectedAction.parameters.find(
|
||||
(param) => param.name === "body"
|
||||
);
|
||||
const paramcheck = selectedAction.parameters.find((param) => param.name === "body");
|
||||
|
||||
|
||||
if (paramcheck !== undefined && paramcheck !== null) {
|
||||
if (
|
||||
@@ -1426,8 +1423,8 @@ const ParsedAction = (props) => {
|
||||
|
||||
setHideBody(!hideBody);
|
||||
|
||||
for (let [key,keyval] in selectedActionParameters.entries()) {
|
||||
var currentItem = selectedActionParameters[key];
|
||||
for (let paramkey in Object.entries(selectedActionParameters)) {
|
||||
var currentItem = selectedActionParameters[paramkey];
|
||||
if (currentItem.name === "ssl_verify") {
|
||||
|
||||
}
|
||||
@@ -1472,10 +1469,11 @@ const ParsedAction = (props) => {
|
||||
openApiHelperText = "OpenAPI spec: fill the following fields.";
|
||||
//console.log("SHOULD ADD TO selectedActionParameters!: ", found, selectedActionParameters)
|
||||
var changed = false;
|
||||
for (let [specKey,specKeyVal] in found.entries()) {
|
||||
for (let specKey in found) {
|
||||
const tmpitem = found[specKey];
|
||||
var skip = false;
|
||||
for (let [innerkey,innerkeyval] in selectedActionParameters.entries()) {
|
||||
|
||||
for (let innerkey in selectedActionParameters) {
|
||||
if (selectedActionParameters[innerkey].name === tmpitem) {
|
||||
skip = true;
|
||||
break;
|
||||
@@ -1707,7 +1705,7 @@ const ParsedAction = (props) => {
|
||||
|
||||
var foundnewline = false
|
||||
var allValues = []
|
||||
for (let [key,keyval] in splitdata.entries()) {
|
||||
for (let [key,keyval] in Object.entries(splitdata)) {
|
||||
const line = splitdata[key]
|
||||
if (line === "") {
|
||||
foundnewline = true
|
||||
@@ -1777,7 +1775,7 @@ const ParsedAction = (props) => {
|
||||
const tmpsplit = selectedActionParameters[count].value.split("\n")
|
||||
var valsplit = []
|
||||
var add_empty = false
|
||||
for (let [key,keyval] in tmpsplit.entries()) {
|
||||
for (let [key,keyval] in Object.entries(tmpsplit)) {
|
||||
if (tmpsplit[key] === "") {
|
||||
add_empty = true
|
||||
continue
|
||||
@@ -1792,7 +1790,7 @@ const ParsedAction = (props) => {
|
||||
console.log("Split: ", valsplit)
|
||||
|
||||
var newarr = []
|
||||
for (let [key,keyval] in valsplit.entries()) {
|
||||
for (let [key,keyval] in Object.entries(valsplit)) {
|
||||
var line = valsplit[key]
|
||||
|
||||
if (key == index) {
|
||||
@@ -1832,7 +1830,7 @@ const ParsedAction = (props) => {
|
||||
var tmpsplit = selectedActionParameters[count].value.split("\n")
|
||||
var valsplit = []
|
||||
var add_empty = false
|
||||
for (let [key,keyval] in tmpsplit.entries()) {
|
||||
for (let [key,keyval] in Object.entries(tmpsplit)) {
|
||||
if (tmpsplit[key] === "") {
|
||||
add_empty = true
|
||||
continue
|
||||
@@ -1847,7 +1845,7 @@ const ParsedAction = (props) => {
|
||||
console.log("Split: ", valsplit)
|
||||
|
||||
var newarr = []
|
||||
for (let [key,keyval] in valsplit.entries()) {
|
||||
for (let [key,keyval] in Object.entries(valsplit)) {
|
||||
var line = valsplit[key]
|
||||
|
||||
if (key == index) {
|
||||
@@ -2094,7 +2092,7 @@ const ParsedAction = (props) => {
|
||||
: "$" + values[0].autocomplete;
|
||||
|
||||
toComplete = toComplete.toLowerCase().replaceAll(" ", "_");
|
||||
for (let [key,keyval] in values.entries()) {
|
||||
for (let [key,keyval] in Object.entries(values)) {
|
||||
if (key == 0 || values[key].autocomplete.length === 0) {
|
||||
continue;
|
||||
}
|
||||
@@ -2205,7 +2203,7 @@ const ParsedAction = (props) => {
|
||||
workflow.triggers !== null &&
|
||||
workflow.triggers.length > 0
|
||||
) {
|
||||
for (let [key,keyval] in workflow.triggers.entries()) {
|
||||
for (let [key,keyval] in Object.entries(workflow.triggers)) {
|
||||
const item = workflow.triggers[key];
|
||||
|
||||
if (cy !== undefined) {
|
||||
@@ -2727,7 +2725,7 @@ const ParsedAction = (props) => {
|
||||
if (workflowExecutions.length > 0) {
|
||||
// Look for the ID
|
||||
const found = false;
|
||||
for (let [key,keyval] in workflowExecutions.entries()) {
|
||||
for (let [key,keyval] in Object.entries(workflowExecutions)) {
|
||||
if (
|
||||
workflowExecutions[key].results === undefined ||
|
||||
workflowExecutions[key].results === null
|
||||
@@ -2735,6 +2733,11 @@ const ParsedAction = (props) => {
|
||||
continue;
|
||||
}
|
||||
|
||||
// Enforces it to show at least one
|
||||
//if (workflowExecutions[key].execution_argument.includes("too large") && key !== workflowExecutions.length - 1) {
|
||||
// continue
|
||||
//}
|
||||
|
||||
var foundResult = workflowExecutions[key].results.find(
|
||||
(result) => result.action.id === selectedAction.id
|
||||
)
|
||||
@@ -2971,8 +2974,8 @@ const ParsedAction = (props) => {
|
||||
//
|
||||
// Should make it a function lol
|
||||
if (workflow.branches !== undefined && workflow.branches !== null) {
|
||||
for (let [key,keyval] in workflow.branches.entries()) {
|
||||
for (let [subkey,subkeyval] in workflow.branches[key].conditions.entries()) {
|
||||
for (let [key,keyval] in Object.entries(workflow.branches)) {
|
||||
for (let [subkey,subkeyval] in Object.entries(workflow.branches[key].conditions)) {
|
||||
const condition = workflow.branches[key].conditions[subkey]
|
||||
const sourceparam = condition.source
|
||||
const destinationparam = condition.destination
|
||||
@@ -3080,12 +3083,12 @@ const ParsedAction = (props) => {
|
||||
}
|
||||
}
|
||||
|
||||
for (let [key,keyval] in workflow.actions.entries()) {
|
||||
for (let [key,keyval] in Object.entries(workflow.actions)) {
|
||||
if (workflow.actions[key].id === selectedAction.id) {
|
||||
continue
|
||||
}
|
||||
|
||||
for (let [subkey, subkeyval] in workflow.actions[key].parameters.entries()) {
|
||||
for (let [subkey, subkeyval] in Object.entries(workflow.actions[key].parameters)) {
|
||||
const param = workflow.actions[key].parameters[subkey];
|
||||
if (!param.value.includes("$")) {
|
||||
continue
|
||||
@@ -3251,7 +3254,7 @@ const ParsedAction = (props) => {
|
||||
selectedAction.selectedAuthentication = {};
|
||||
selectedAction.authentication_id = "";
|
||||
|
||||
for (let [key,keyval] in selectedAction.parameters.entries()) {
|
||||
for (let [key,keyval] in Object.entries(selectedAction.parameters)) {
|
||||
//console.log(selectedAction.parameters[key])
|
||||
if (selectedAction.parameters[key].configuration) {
|
||||
selectedAction.parameters[key].value = "";
|
||||
@@ -3568,7 +3571,7 @@ const ParsedAction = (props) => {
|
||||
if (method.length > 0 && data.description !== undefined && data.description !== null && data.description.includes("http")) {
|
||||
var extraUrl = ""
|
||||
const descSplit = data.description.split("\n")
|
||||
for (let [line,lineval] in descSplit.entries()) {
|
||||
for (let [line,lineval] in Object.entries(descSplit)) {
|
||||
if (descSplit[line].includes("http") && descSplit[line].includes("://")) {
|
||||
const urlsplit = descSplit[line].split("/")
|
||||
try {
|
||||
@@ -3629,7 +3632,7 @@ const ParsedAction = (props) => {
|
||||
renderInput={(params) => {
|
||||
if (params.inputProps !== undefined && params.inputProps !== null && params.inputProps.value !== undefined && params.inputProps.value !== null) {
|
||||
const prefixes = ["Post", "Put", "Patch"]
|
||||
for (let [key,keyval] in prefixes.entries()) {
|
||||
for (let [key,keyval] in Object.entries(prefixes)) {
|
||||
if (params.inputProps.value.startsWith(prefixes[key])) {
|
||||
params.inputProps.value = params.inputProps.value.replace(prefixes[key]+" ", "", -1)
|
||||
if (params.inputProps.value.length > 1) {
|
||||
|
||||
@@ -594,7 +594,7 @@ const WelcomeForm = (props) => {
|
||||
<Fade in={true}>
|
||||
<div style={{minHeight: sizing, maxHeight: sizing, marginTop: 20, maxWidth: 500, }}>
|
||||
<Typography variant="body1" style={{marginLeft: 8, marginTop: 50, marginRight: 30, marginBottom: 0, }} color="textSecondary">
|
||||
Use the buttons below to find your apps, and we will help you connect them later.
|
||||
Apps for each category are shown based on your activity and can be changed by clicking their icon. We will help you connect them later.
|
||||
</Typography>
|
||||
{/*The app framework helps us access and authenticate the most important APIs for you. */}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user