Fixed minor frontend issues related to unparsable data

This commit is contained in:
frikky
2022-07-28 02:19:05 +02:00
parent 1950c54ec8
commit 856daaacda
4 changed files with 67 additions and 58 deletions
+1 -1
View File
@@ -24,7 +24,7 @@ require (
github.com/h2non/filetype v1.1.3 github.com/h2non/filetype v1.1.3
github.com/nirasan/go-oauth-pkce-code-verifier v0.0.0-20170819232839-0fbfe93532da // indirect github.com/nirasan/go-oauth-pkce-code-verifier v0.0.0-20170819232839-0fbfe93532da // indirect
github.com/satori/go.uuid v1.2.0 github.com/satori/go.uuid v1.2.0
github.com/shuffle/shuffle-shared v0.2.72 github.com/shuffle/shuffle-shared v0.2.73
go4.org v0.0.0-20201209231011-d4a079459e60 // indirect go4.org v0.0.0-20201209231011-d4a079459e60 // indirect
golang.org/x/crypto v0.0.0-20220112180741-5e0467b6c7ce golang.org/x/crypto v0.0.0-20220112180741-5e0467b6c7ce
google.golang.org/api v0.65.0 google.golang.org/api v0.65.0
-1
View File
@@ -723,7 +723,6 @@ const Header = (props) => {
userdata.orgs.splice(foundIndex+1, 1) userdata.orgs.splice(foundIndex+1, 1)
} else { } else {
console.log("ORG NOT FOUND IN LIST: ", childorg) console.log("ORG NOT FOUND IN LIST: ", childorg)
} }
// This is stupid :) // This is stupid :)
+57 -52
View File
@@ -342,77 +342,82 @@ const CodeEditor = (props) => {
const expectedOutput = (input) => { const expectedOutput = (input) => {
const found = input.match(/[$]{1}([a-zA-Z0-9_-]+\.?){1}([a-zA-Z0-9#_-]+\.?){0,}/g) const found = input.match(/[$]{1}([a-zA-Z0-9_-]+\.?){1}([a-zA-Z0-9#_-]+\.?){0,}/g)
//console.log(found) //console.log(found)
// Whelp this is inefficient af. Single loop pls // Whelp this is inefficient af. Single loop pls
// When the found array is empty. // When the found array is empty.
for (var i = 0; i < found.length; i++) { try {
try { for (var i = 0; i < found.length; i++) {
found[i] = found[i].toLowerCase() try {
found[i] = found[i].toLowerCase()
var valuefound = false var valuefound = false
for (var j = 0; j < actionlist.length; j++) { for (var j = 0; j < actionlist.length; j++) {
if(found[i].slice(1,).toLowerCase() === actionlist[j].autocomplete.toLowerCase()){ if(found[i].slice(1,).toLowerCase() === actionlist[j].autocomplete.toLowerCase()){
valuefound = true valuefound = true
try { try {
input = input.replace(found[i], JSON.stringify(actionlist[j].example)); input = input.replace(found[i], JSON.stringify(actionlist[j].example));
} catch (e) { } catch (e) {
input = input.replace(found[i], actionlist[j].example) input = input.replace(found[i], actionlist[j].example)
}
} else {
} }
} else {
} }
}
if (!valuefound && availableVariables.includes(found[i])) { if (!valuefound && availableVariables.includes(found[i])) {
var shouldbreak = false var shouldbreak = false
for (var k=0; k < actionlist.length; k++){ for (var k=0; k < actionlist.length; k++){
var parsedPaths = [] var parsedPaths = []
if (typeof actionlist[k].example === "object") { if (typeof actionlist[k].example === "object") {
parsedPaths = GetParsedPaths(actionlist[k].example, ""); parsedPaths = GetParsedPaths(actionlist[k].example, "");
} }
for (var key in parsedPaths) { for (var key in parsedPaths) {
const fullpath = "$"+actionlist[k].autocomplete.toLowerCase()+parsedPaths[key].autocomplete const fullpath = "$"+actionlist[k].autocomplete.toLowerCase()+parsedPaths[key].autocomplete
if (fullpath === found[i]) { if (fullpath === found[i]) {
//if (actionlist[k].example === undefined) { //if (actionlist[k].example === undefined) {
// actionlist[k].example = "TMP" // actionlist[k].example = "TMP"
//} //}
try { try {
var new_input = FindJsonPath(fullpath, actionlist[k].example) var new_input = FindJsonPath(fullpath, actionlist[k].example)
} catch (e) { } catch (e) {
console.log("ERR IN INPUT: ", 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 = ""
} }
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) if (shouldbreak) {
//} catch (e) {
// input = input.replace(found[i], actionlist[k].example)
//}
shouldbreak = true
break 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()) const tmpValidation = validateJson(input.valueOf())
+9 -4
View File
@@ -414,9 +414,11 @@ const AngularWorkflow = (defaultprops) => {
console.log("RESPONSE FOR APP: ", responseJson.reason); console.log("RESPONSE FOR APP: ", responseJson.reason);
if (responseJson.reason !== undefined && responseJson.reason !== undefined && responseJson.reason.length > 0) { if (responseJson.reason !== undefined && responseJson.reason !== undefined && responseJson.reason.length > 0) {
selectedApp.documentation = responseJson.reason if (!responseJson.reason.includes("404: Not Found") && responseJson.reason.length > 50) {
setSelectedApp(selectedApp) selectedApp.documentation = responseJson.reason
setUpdate(Math.random()) setSelectedApp(selectedApp)
setUpdate(Math.random())
}
} }
} }
@@ -6167,8 +6169,11 @@ const AngularWorkflow = (defaultprops) => {
//newSelectedAction.parameters[newParamIndex].value = param.value //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) const newParamIndex = newSelectedAction.parameters.findIndex(paramdata => paramdata.name === param.name)
if (newParamIndex < 0) { if (newParamIndex < 0) {
continue continue