Fixed minor frontend issues related to unparsable data
This commit is contained in:
@@ -723,7 +723,6 @@ const Header = (props) => {
|
||||
userdata.orgs.splice(foundIndex+1, 1)
|
||||
} else {
|
||||
console.log("ORG NOT FOUND IN LIST: ", childorg)
|
||||
|
||||
}
|
||||
|
||||
// This is stupid :)
|
||||
|
||||
@@ -342,77 +342,82 @@ const CodeEditor = (props) => {
|
||||
const expectedOutput = (input) => {
|
||||
|
||||
const found = input.match(/[$]{1}([a-zA-Z0-9_-]+\.?){1}([a-zA-Z0-9#_-]+\.?){0,}/g)
|
||||
|
||||
//console.log(found)
|
||||
|
||||
// Whelp this is inefficient af. Single loop pls
|
||||
// When the found array is empty.
|
||||
for (var i = 0; i < found.length; i++) {
|
||||
try {
|
||||
found[i] = found[i].toLowerCase()
|
||||
try {
|
||||
for (var i = 0; i < found.length; i++) {
|
||||
try {
|
||||
found[i] = found[i].toLowerCase()
|
||||
|
||||
var valuefound = false
|
||||
for (var j = 0; j < actionlist.length; j++) {
|
||||
if(found[i].slice(1,).toLowerCase() === actionlist[j].autocomplete.toLowerCase()){
|
||||
valuefound = true
|
||||
try {
|
||||
input = input.replace(found[i], JSON.stringify(actionlist[j].example));
|
||||
} catch (e) {
|
||||
input = input.replace(found[i], actionlist[j].example)
|
||||
var valuefound = false
|
||||
for (var j = 0; j < actionlist.length; j++) {
|
||||
if(found[i].slice(1,).toLowerCase() === actionlist[j].autocomplete.toLowerCase()){
|
||||
valuefound = true
|
||||
try {
|
||||
input = input.replace(found[i], JSON.stringify(actionlist[j].example));
|
||||
} catch (e) {
|
||||
input = input.replace(found[i], actionlist[j].example)
|
||||
}
|
||||
} else {
|
||||
}
|
||||
} else {
|
||||
}
|
||||
}
|
||||
|
||||
if (!valuefound && availableVariables.includes(found[i])) {
|
||||
var shouldbreak = false
|
||||
for (var k=0; k < actionlist.length; k++){
|
||||
var parsedPaths = []
|
||||
if (typeof actionlist[k].example === "object") {
|
||||
parsedPaths = GetParsedPaths(actionlist[k].example, "");
|
||||
}
|
||||
if (!valuefound && availableVariables.includes(found[i])) {
|
||||
var shouldbreak = false
|
||||
for (var k=0; k < actionlist.length; k++){
|
||||
var parsedPaths = []
|
||||
if (typeof actionlist[k].example === "object") {
|
||||
parsedPaths = GetParsedPaths(actionlist[k].example, "");
|
||||
}
|
||||
|
||||
for (var key in parsedPaths) {
|
||||
const fullpath = "$"+actionlist[k].autocomplete.toLowerCase()+parsedPaths[key].autocomplete
|
||||
if (fullpath === found[i]) {
|
||||
//if (actionlist[k].example === undefined) {
|
||||
// actionlist[k].example = "TMP"
|
||||
//}
|
||||
for (var key in parsedPaths) {
|
||||
const fullpath = "$"+actionlist[k].autocomplete.toLowerCase()+parsedPaths[key].autocomplete
|
||||
if (fullpath === found[i]) {
|
||||
//if (actionlist[k].example === undefined) {
|
||||
// actionlist[k].example = "TMP"
|
||||
//}
|
||||
|
||||
try {
|
||||
var new_input = FindJsonPath(fullpath, actionlist[k].example)
|
||||
} catch (e) {
|
||||
console.log("ERR IN INPUT: ", e)
|
||||
}
|
||||
|
||||
if (typeof new_input === "object") {
|
||||
new_input = JSON.stringify(new_input)
|
||||
} else {
|
||||
if (typeof new_input === "string") {
|
||||
new_input = new_input
|
||||
} else {
|
||||
new_input = ""
|
||||
try {
|
||||
var new_input = FindJsonPath(fullpath, actionlist[k].example)
|
||||
} catch (e) {
|
||||
console.log("ERR IN INPUT: ", e)
|
||||
}
|
||||
|
||||
if (typeof new_input === "object") {
|
||||
new_input = JSON.stringify(new_input)
|
||||
} else {
|
||||
if (typeof new_input === "string") {
|
||||
new_input = new_input
|
||||
} else {
|
||||
new_input = ""
|
||||
}
|
||||
}
|
||||
|
||||
input = input.replace(found[i], new_input)
|
||||
|
||||
//} catch (e) {
|
||||
// input = input.replace(found[i], actionlist[k].example)
|
||||
//}
|
||||
|
||||
shouldbreak = true
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
input = input.replace(found[i], new_input)
|
||||
|
||||
//} catch (e) {
|
||||
// input = input.replace(found[i], actionlist[k].example)
|
||||
//}
|
||||
|
||||
shouldbreak = true
|
||||
if (shouldbreak) {
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
if (shouldbreak) {
|
||||
break
|
||||
}
|
||||
}
|
||||
} catch (e) {
|
||||
console.log("Replace error: ", e)
|
||||
}
|
||||
} catch (e) {
|
||||
console.log("Replace error: ", e)
|
||||
}
|
||||
} catch (e) {
|
||||
|
||||
}
|
||||
|
||||
const tmpValidation = validateJson(input.valueOf())
|
||||
|
||||
@@ -414,9 +414,11 @@ const AngularWorkflow = (defaultprops) => {
|
||||
console.log("RESPONSE FOR APP: ", responseJson.reason);
|
||||
|
||||
if (responseJson.reason !== undefined && responseJson.reason !== undefined && responseJson.reason.length > 0) {
|
||||
selectedApp.documentation = responseJson.reason
|
||||
setSelectedApp(selectedApp)
|
||||
setUpdate(Math.random())
|
||||
if (!responseJson.reason.includes("404: Not Found") && responseJson.reason.length > 50) {
|
||||
selectedApp.documentation = responseJson.reason
|
||||
setSelectedApp(selectedApp)
|
||||
setUpdate(Math.random())
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6167,8 +6169,11 @@ const AngularWorkflow = (defaultprops) => {
|
||||
//newSelectedAction.parameters[newParamIndex].value = param.value
|
||||
}
|
||||
|
||||
// Not doing options fields
|
||||
if (newSelectedAction.parameters === undefined || newSelectedAction.parameters === null) {
|
||||
continue
|
||||
}
|
||||
|
||||
// Not doing options fields
|
||||
const newParamIndex = newSelectedAction.parameters.findIndex(paramdata => paramdata.name === param.name)
|
||||
if (newParamIndex < 0) {
|
||||
continue
|
||||
|
||||
Reference in New Issue
Block a user