Showing the correct parents in autocompletion
This commit is contained in:
@@ -162,6 +162,7 @@ const ParsedAction = (props) => {
|
|||||||
appAuthentication,
|
appAuthentication,
|
||||||
getAppAuthentication,
|
getAppAuthentication,
|
||||||
actionDelayChange,
|
actionDelayChange,
|
||||||
|
getParents,
|
||||||
isCloud,
|
isCloud,
|
||||||
} = props;
|
} = props;
|
||||||
|
|
||||||
@@ -186,62 +187,6 @@ const ParsedAction = (props) => {
|
|||||||
"parse(",
|
"parse(",
|
||||||
"join(",
|
"join(",
|
||||||
];
|
];
|
||||||
const getParents = (action) => {
|
|
||||||
if (cy === undefined) {
|
|
||||||
return [];
|
|
||||||
}
|
|
||||||
|
|
||||||
var allkeys = [action.id];
|
|
||||||
var handled = [];
|
|
||||||
var results = [];
|
|
||||||
|
|
||||||
while (true) {
|
|
||||||
for (var key in allkeys) {
|
|
||||||
var currentnode = cy.getElementById(allkeys[key]);
|
|
||||||
if (currentnode === undefined) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (handled.includes(currentnode.data("id"))) {
|
|
||||||
continue;
|
|
||||||
} else {
|
|
||||||
// Get the name / label here too?
|
|
||||||
handled.push(currentnode.data("id"));
|
|
||||||
results.push(currentnode.data());
|
|
||||||
}
|
|
||||||
|
|
||||||
if (currentnode.length === 0) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
const incomingEdges = currentnode.incomers("edge");
|
|
||||||
if (incomingEdges.length === 0) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
for (var i = 0; i < incomingEdges.length; i++) {
|
|
||||||
var tmp = incomingEdges[i];
|
|
||||||
if (!allkeys.includes(tmp.data().source)) {
|
|
||||||
allkeys.push(tmp.data().source);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (results.length === allkeys.length) {
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Some obscure bug made this have to be done.. zz
|
|
||||||
results = results.filter(
|
|
||||||
(data) =>
|
|
||||||
data !== undefined && action !== undefined && data.id !== action.id
|
|
||||||
);
|
|
||||||
results = results.filter(
|
|
||||||
(data) => data !== undefined && data.type !== "TRIGGER"
|
|
||||||
);
|
|
||||||
results.push({ label: "Execution Argument", type: "INTERNAL" });
|
|
||||||
return results;
|
|
||||||
};
|
|
||||||
|
|
||||||
const getApp = (appId, setApp) => {
|
const getApp = (appId, setApp) => {
|
||||||
fetch(globalUrl + "/api/v1/apps/" + appId + "/config?openapi=false", {
|
fetch(globalUrl + "/api/v1/apps/" + appId + "/config?openapi=false", {
|
||||||
|
|||||||
@@ -2362,6 +2362,7 @@ const AngularWorkflow = (defaultprops) => {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
console.log("DATA: ", data)
|
||||||
setSelectedTriggerIndex(trigger_index);
|
setSelectedTriggerIndex(trigger_index);
|
||||||
setSelectedTrigger(data);
|
setSelectedTrigger(data);
|
||||||
setSelectedActionEnvironment(data.env);
|
setSelectedActionEnvironment(data.env);
|
||||||
@@ -5527,8 +5528,12 @@ const AngularWorkflow = (defaultprops) => {
|
|||||||
|
|
||||||
for (var i = 0; i < incomingEdges.length; i++) {
|
for (var i = 0; i < incomingEdges.length; i++) {
|
||||||
var tmp = incomingEdges[i];
|
var tmp = incomingEdges[i];
|
||||||
if (!allkeys.includes(tmp.data().source)) {
|
if (tmp.data("decorator")) {
|
||||||
allkeys.push(tmp.data().source);
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!allkeys.includes(tmp.data("source"))) {
|
||||||
|
allkeys.push(tmp.data("source"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -5540,9 +5545,10 @@ const AngularWorkflow = (defaultprops) => {
|
|||||||
iterations += 1;
|
iterations += 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Remove self
|
// Remove on the end as we don't want to remove everything
|
||||||
results = results.filter((data) => data.id !== action.id);
|
results = results.filter((data) => data.id !== action.id);
|
||||||
results = results.filter((data) => data.type !== "TRIGGER");
|
results = results.filter((data) => data.type === "ACTION" || data.app_name === "Shuffle Workflow" || data.app_name === "User Input");
|
||||||
|
console.log("RESULTS:", results)
|
||||||
results.push({ label: "Execution Argument", type: "INTERNAL" });
|
results.push({ label: "Execution Argument", type: "INTERNAL" });
|
||||||
return results;
|
return results;
|
||||||
};
|
};
|
||||||
@@ -7302,44 +7308,11 @@ const AngularWorkflow = (defaultprops) => {
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
foundResult.result = foundResult.result.trim();
|
const validated = validateJson(foundResult.result)
|
||||||
foundResult.result = foundResult.result
|
if (validated.valid) {
|
||||||
.split(" None")
|
exampledata = validateJson.result
|
||||||
.join(' "None"');
|
break
|
||||||
foundResult.result = foundResult.result
|
}
|
||||||
.split(" False")
|
|
||||||
.join(" false");
|
|
||||||
foundResult.result = foundResult.result
|
|
||||||
.split(" True")
|
|
||||||
.join(" true");
|
|
||||||
|
|
||||||
var jsonvalid = true;
|
|
||||||
try {
|
|
||||||
if (
|
|
||||||
!foundResult.result.includes("{") &&
|
|
||||||
!foundResult.result.includes("[")
|
|
||||||
) {
|
|
||||||
jsonvalid = false;
|
|
||||||
}
|
|
||||||
} catch (e) {
|
|
||||||
try {
|
|
||||||
foundResult.result = foundResult.result.split("'").join('"');
|
|
||||||
if (
|
|
||||||
!foundResult.result.includes("{") &&
|
|
||||||
!foundResult.result.includes("[")
|
|
||||||
) {
|
|
||||||
jsonvalid = false;
|
|
||||||
}
|
|
||||||
} catch (e) {
|
|
||||||
jsonvalid = false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Finds the FIRST json only
|
|
||||||
if (jsonvalid) {
|
|
||||||
exampledata = JSON.parse(foundResult.result);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -7350,7 +7323,7 @@ const AngularWorkflow = (defaultprops) => {
|
|||||||
name: item.label,
|
name: item.label,
|
||||||
autocomplete: `${item.label.split(" ").join("_")}`,
|
autocomplete: `${item.label.split(" ").join("_")}`,
|
||||||
example: exampledata,
|
example: exampledata,
|
||||||
};
|
}
|
||||||
actionlist.push(actionvalue);
|
actionlist.push(actionvalue);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -10181,6 +10154,7 @@ const AngularWorkflow = (defaultprops) => {
|
|||||||
<ParsedAction
|
<ParsedAction
|
||||||
id="rightside_subactions"
|
id="rightside_subactions"
|
||||||
isCloud={isCloud}
|
isCloud={isCloud}
|
||||||
|
getParents={getParents}
|
||||||
actionDelayChange={actionDelayChange}
|
actionDelayChange={actionDelayChange}
|
||||||
getAppAuthentication={getAppAuthentication}
|
getAppAuthentication={getAppAuthentication}
|
||||||
appAuthentication={appAuthentication}
|
appAuthentication={appAuthentication}
|
||||||
|
|||||||
Reference in New Issue
Block a user