fixed PrasedAction.jsx and few more fixes to ConfiguredWorkflow & Angularworkflow.jsx

This commit is contained in:
Dhaval Dave
2023-01-13 05:35:19 +00:00
parent 20350178e3
commit 7e1cccf820
3 changed files with 30 additions and 30 deletions
+3 -3
View File
@@ -1472,7 +1472,7 @@ const ParsedAction = (props) => {
openApiHelperText = "OpenAPI spec: fill the following fields."; openApiHelperText = "OpenAPI spec: fill the following fields.";
//console.log("SHOULD ADD TO selectedActionParameters!: ", found, selectedActionParameters) //console.log("SHOULD ADD TO selectedActionParameters!: ", found, selectedActionParameters)
var changed = false; var changed = false;
for (let [speckey,speckeyval] in found.entries()) { for (let [specKey,specKeyVal] in found.entries()) {
const tmpitem = found[specKey]; const tmpitem = found[specKey];
var skip = false; var skip = false;
for (let [innerkey,innerkeyval] in selectedActionParameters.entries()) { for (let [innerkey,innerkeyval] in selectedActionParameters.entries()) {
@@ -2972,7 +2972,7 @@ const ParsedAction = (props) => {
// Should make it a function lol // Should make it a function lol
if (workflow.branches !== undefined && workflow.branches !== null) { if (workflow.branches !== undefined && workflow.branches !== null) {
for (let [key,keyval] in workflow.branches.entries()) { for (let [key,keyval] in workflow.branches.entries()) {
for (let [key,keyval] in workflow.branches[key].conditions.entries()) { for (let [subkey,subkeyval] in workflow.branches[key].conditions.entries()) {
const condition = workflow.branches[key].conditions[subkey] const condition = workflow.branches[key].conditions[subkey]
const sourceparam = condition.source const sourceparam = condition.source
const destinationparam = condition.destination const destinationparam = condition.destination
@@ -3568,7 +3568,7 @@ const ParsedAction = (props) => {
if (method.length > 0 && data.description !== undefined && data.description !== null && data.description.includes("http")) { if (method.length > 0 && data.description !== undefined && data.description !== null && data.description.includes("http")) {
var extraUrl = "" var extraUrl = ""
const descSplit = data.description.split("\n") const descSplit = data.description.split("\n")
for (let [key,keyval] in descSplit.entries()) { for (let [line,lineval] in descSplit.entries()) {
if (descSplit[line].includes("http") && descSplit[line].includes("://")) { if (descSplit[line].includes("http") && descSplit[line].includes("://")) {
const urlsplit = descSplit[line].split("/") const urlsplit = descSplit[line].split("/")
try { try {
+2 -2
View File
@@ -1549,7 +1549,7 @@ const AngularWorkflow = (defaultprops) => {
var item = tmpAuth[key]; var item = tmpAuth[key];
const newfields = {}; const newfields = {};
for (let [key,keyval] in item.fields.entries()) { for (let [filterkey, filterkeyval] in item.fields.entries()) {
newfields[item.fields[filterkey].key] = newfields[item.fields[filterkey].key] =
item.fields[filterkey].value; item.fields[filterkey].value;
} }
@@ -2026,7 +2026,7 @@ const AngularWorkflow = (defaultprops) => {
// Wait for new node to possibly be selected // Wait for new node to possibly be selected
//setTimeout(() => { //setTimeout(() => {
const typeIds = cy.elements('node:selected').jsons(); const typeIds = cy.elements('node:selected').jsons();
for (let [key,keyval] in typeIds.entries()) { for (let [idkey,idkeyval] in typeIds.entries()) {
const item = typeIds[idkey] const item = typeIds[idkey]
if (item.data.isButton === true) { if (item.data.isButton === true) {
//console.log("Reselect old node & return - or just return?") //console.log("Reselect old node & return - or just return?")
+25 -25
View File
@@ -456,7 +456,7 @@ const AppCreator = (defaultprops) => {
} }
var newitem = data; var newitem = data;
for (var key in paramsplit) { for (let [key,keyval] in paramsplit.entries()) {
var tmpparam = paramsplit[key]; var tmpparam = paramsplit[key];
if (tmpparam === "#") { if (tmpparam === "#") {
continue; continue;
@@ -579,7 +579,7 @@ const AppCreator = (defaultprops) => {
console.log("Tags: ", data.tags) console.log("Tags: ", data.tags)
if (data.tags !== undefined && data.tags.length > 0) { if (data.tags !== undefined && data.tags.length > 0) {
var newtags = []; var newtags = [];
for (var key in data.tags) { for (let [key,keyval] in data.tags.entries()) {
if (data.tags[key].name.length > 50) { if (data.tags[key].name.length > 50) {
console.log( console.log(
"Skipping tag because it's too long: ", "Skipping tag because it's too long: ",
@@ -685,7 +685,7 @@ const AppCreator = (defaultprops) => {
const pathsplit = path.split("/"); const pathsplit = path.split("/");
var categoryindex = -1; var categoryindex = -1;
// Stupid way of finding a category/grouping // Stupid way of finding a category/grouping
for (var key in pathsplit) { for (let [key,keyval] in pathsplit.entries()) {
if (pathsplit[key].includes("_shuffle_replace_")) { if (pathsplit[key].includes("_shuffle_replace_")) {
const regex = /_shuffle_replace_\d/i; const regex = /_shuffle_replace_\d/i;
//console.log("NEW: ", //console.log("NEW: ",
@@ -750,9 +750,9 @@ const AppCreator = (defaultprops) => {
} }
//console.log("Data: ", data) //console.log("Data: ", data)
for (var subkey in methodvalue["requestBody"]["content"][ for (let [subkey,subkeyval] in methodvalue["requestBody"]["content"][
"application/json" "application/json"
]["schema"]["required"]) { ]["schema"]["required"].entries()) {
const tmpitem = const tmpitem =
methodvalue["requestBody"]["content"][ methodvalue["requestBody"]["content"][
"application/json" "application/json"
@@ -771,7 +771,7 @@ const AppCreator = (defaultprops) => {
); );
var newbody = {}; var newbody = {};
// Can handle default, required, description and type // Can handle default, required, description and type
for (var propkey in retRef.properties) { for (let [propkey,propkeyval] in retRef.properties.entries()) {
console.log("replace: ", propkey) console.log("replace: ", propkey)
const parsedkey = propkey.replaceAll(" ", "_").toLowerCase(); const parsedkey = propkey.replaceAll(" ", "_").toLowerCase();
@@ -810,9 +810,9 @@ const AppCreator = (defaultprops) => {
tmpobject[prop] = `\$\{${prop}\}`; tmpobject[prop] = `\$\{${prop}\}`;
} }
for (var subkey in methodvalue["requestBody"]["content"][ for (let [subkey,subkeyval] in methodvalue["requestBody"]["content"][
"application/xml" "application/xml"
]["schema"]["required"]) { ]["schema"]["required"].entries()) {
const tmpitem = const tmpitem =
methodvalue["requestBody"]["content"][ methodvalue["requestBody"]["content"][
"application/xml" "application/xml"
@@ -917,7 +917,7 @@ const AppCreator = (defaultprops) => {
parameter["type"] === "object" parameter["type"] === "object"
) { ) {
var newbody = {}; var newbody = {};
for (var propkey in parameter.properties) { for (let [propkey,propkeyval] in parameter.properties.entries()) {
console.log("propkey2: ", propkey) console.log("propkey2: ", propkey)
const parsedkey = propkey.replaceAll(" ", "_").toLowerCase(); const parsedkey = propkey.replaceAll(" ", "_").toLowerCase();
if (parameter.properties[propkey].type === undefined) { if (parameter.properties[propkey].type === undefined) {
@@ -1046,7 +1046,7 @@ const AppCreator = (defaultprops) => {
parameter["type"] === "object" parameter["type"] === "object"
) { ) {
var newbody = {}; var newbody = {};
for (var propkey in parameter.properties) { for (let [propkey,propkeyval] in parameter.properties.entries()) {
console.log("propkey3: ", propkey) console.log("propkey3: ", propkey)
const parsedkey = propkey.replaceAll(" ", "_").toLowerCase(); const parsedkey = propkey.replaceAll(" ", "_").toLowerCase();
if ( if (
@@ -1135,7 +1135,7 @@ const AppCreator = (defaultprops) => {
parameter["type"] === "object" parameter["type"] === "object"
) { ) {
var newbody = {}; var newbody = {};
for (var propkey in parameter.properties) { for (let [propkey,propkeyval] in parameter.properties.entries()) {
console.log("propkey4: ", propkey) console.log("propkey4: ", propkey)
const parsedkey = propkey.replaceAll(" ", "_").toLowerCase(); const parsedkey = propkey.replaceAll(" ", "_").toLowerCase();
if ( if (
@@ -1219,7 +1219,7 @@ const AppCreator = (defaultprops) => {
parameter["type"] === "object" parameter["type"] === "object"
) { ) {
var newbody = {}; var newbody = {};
for (var propkey in parameter.properties) { for (let [propkey,keyval] in parameter.properties.entries()) {
console.log("propkey5: ", propkey) console.log("propkey5: ", propkey)
const parsedkey = propkey const parsedkey = propkey
.replaceAll(" ", "_") .replaceAll(" ", "_")
@@ -1287,7 +1287,7 @@ const AppCreator = (defaultprops) => {
} }
} }
for (var key in methodvalue.parameters) { for (let [key,keyval] in methodvalue.parameters.entries()) {
const parameter = handleGetRef(methodvalue.parameters[key], data); const parameter = handleGetRef(methodvalue.parameters[key], data);
if (parameter.in === "query") { if (parameter.in === "query") {
var tmpaction = { var tmpaction = {
@@ -1334,7 +1334,7 @@ const AppCreator = (defaultprops) => {
if (Object.getOwnPropertyNames(wordlist).length === 0) { if (Object.getOwnPropertyNames(wordlist).length === 0) {
for (let [newpath, pathvalue] of Object.entries(data.paths)) { for (let [newpath, pathvalue] of Object.entries(data.paths)) {
const newpathsplit = newpath.split("/"); const newpathsplit = newpath.split("/");
for (var key in newpathsplit) { for (let [key,keyval] in newpathsplit.entries()) {
const pathitem = newpathsplit[key].toLowerCase(); const pathitem = newpathsplit[key].toLowerCase();
if (wordlist[pathitem] === undefined) { if (wordlist[pathitem] === undefined) {
wordlist[pathitem] = 1; wordlist[pathitem] = 1;
@@ -1351,7 +1351,7 @@ const AppCreator = (defaultprops) => {
const urlsplit = path.split("/"); const urlsplit = path.split("/");
if (urlsplit.length > 0) { if (urlsplit.length > 0) {
var curname = ""; var curname = "";
for (var key in urlsplit) { for (let [key,keyval] in urlsplit.entries()) {
var subpath = urlsplit[key]; var subpath = urlsplit[key];
if (wordlist[subpath] > 2 || subpath.length < 1) { if (wordlist[subpath] > 2 || subpath.length < 1) {
continue; continue;
@@ -1413,7 +1413,7 @@ const AppCreator = (defaultprops) => {
const regex = /{\w+}/g; const regex = /{\w+}/g;
const found = firstUrl.match(regex); const found = firstUrl.match(regex);
if (found !== null) { if (found !== null) {
for (var key in found) { for (let [key,keyval] in found.entries()) {
const item = found[key].slice(1, found[key].length - 1); const item = found[key].slice(1, found[key].length - 1);
const foundVar = data.servers[0].variables[item]; const foundVar = data.servers[0].variables[item];
if (foundVar["default"] !== undefined) { if (foundVar["default"] !== undefined) {
@@ -1683,7 +1683,7 @@ const AppCreator = (defaultprops) => {
if (newWorkflowTags.length > 0) { if (newWorkflowTags.length > 0) {
var newtags = []; var newtags = [];
for (var key in newWorkflowTags) { for (let [key,keyval] in newWorkflowTags.entries()) {
newtags.push({ name: newWorkflowTags[key] }); newtags.push({ name: newWorkflowTags[key] });
} }
@@ -1696,7 +1696,7 @@ const AppCreator = (defaultprops) => {
// Handles actions // Handles actions
var handledPaths = [] var handledPaths = []
for (var key in actions) { for (let [key,keyval] in actions.entries()) {
var item = JSON.parse(JSON.stringify(actions[key])) var item = JSON.parse(JSON.stringify(actions[key]))
if (item.errors.length > 0) { if (item.errors.length > 0) {
alert.error("Saving with error in action " + item.name); alert.error("Saving with error in action " + item.name);
@@ -1712,7 +1712,7 @@ const AppCreator = (defaultprops) => {
if (handledPaths.includes(pathjoin)) { if (handledPaths.includes(pathjoin)) {
// Max 100 of same lol // Max 100 of same lol
for (var i = 0; i < 100; i++) { for (let i = 0; i < 100; i++) {
item.url = item.url+"_shuffle_replace_"+i item.url = item.url+"_shuffle_replace_"+i
pathjoin = item.url+"_"+item.method.toLowerCase() pathjoin = item.url+"_"+item.method.toLowerCase()
@@ -1822,7 +1822,7 @@ const AppCreator = (defaultprops) => {
if (item.queries.length > 0) { if (item.queries.length > 0) {
var skipped = false; var skipped = false;
var querynames = [] var querynames = []
for (var querykey in item.queries) { for (let [querykey,querykeyval] in item.queries.entries()) {
const queryitem = item.queries[querykey]; const queryitem = item.queries[querykey];
if (queryitem === undefined || queryitem === null || queryitem.name === undefined || queryitem.name === null || queryitem.name === "") { if (queryitem === undefined || queryitem === null || queryitem.name === undefined || queryitem.name === null || queryitem.name === "") {
@@ -1923,7 +1923,7 @@ const AppCreator = (defaultprops) => {
//data.paths[item.url][item.method.toLowerCase()].parameters.push(newitem) //data.paths[item.url][item.method.toLowerCase()].parameters.push(newitem)
if (item.paths.length > 0) { if (item.paths.length > 0) {
for (querykey in item.paths) { for (let [querykey,querykeyval] in item.paths.entries()) {
const queryitem = item.paths[querykey]; const queryitem = item.paths[querykey];
if (queryitem.toLowerCase() == "url") { if (queryitem.toLowerCase() == "url") {
@@ -1958,7 +1958,7 @@ const AppCreator = (defaultprops) => {
const values = getCurrentPaths(item.url); const values = getCurrentPaths(item.url);
const paths = values[0]; const paths = values[0];
for (querykey in paths) { for (let [querykey,querykeyval] in paths.entries()) {
const queryitem = paths[querykey]; const queryitem = paths[querykey];
newitem = { newitem = {
in: "path", in: "path",
@@ -1996,7 +1996,7 @@ const AppCreator = (defaultprops) => {
// but it's the only way we can properly support e.g. GraphQL // but it's the only way we can properly support e.g. GraphQL
// with good examples // with good examples
var newbody = "" var newbody = ""
for (var key in item.body) { for (let [key,keyval] in item.body.entries()) {
if (item.body[key] === "$") { if (item.body[key] === "$") {
if (key > 0) { if (key > 0) {
//console.log("Found: ", item.body[key-1]) //console.log("Found: ", item.body[key-1])
@@ -2118,9 +2118,9 @@ const AppCreator = (defaultprops) => {
const required = false; const required = false;
const headersSplit = item.headers.split("\n"); const headersSplit = item.headers.split("\n");
for (var key in headersSplit) { for (let [key,keyval] in headersSplit.entries()) {
const header = headersSplit[key]; const header = headersSplit[key];
var key = ""; // var key = "";
var value = ""; var value = "";
if (header.length > 0 && header.includes("= ")) { if (header.length > 0 && header.includes("= ")) {
const headersplit = header.split("= "); const headersplit = header.split("= ");