Fixed autocompleter in Code Editor to work with proper JSON examples
This commit is contained in:
@@ -2590,6 +2590,7 @@ const AngularWorkflow = (defaultprops) => {
|
||||
a.loop_versions.includes(curaction.app_version)))
|
||||
);
|
||||
|
||||
|
||||
if (curaction.template === true) {
|
||||
//newapps.
|
||||
const parsedname = curaction.name.replaceAll(" ", "_").toLowerCase()
|
||||
@@ -2630,6 +2631,12 @@ const AngularWorkflow = (defaultprops) => {
|
||||
setSelectedApp(tmpapp);
|
||||
setSelectedAction(curaction);
|
||||
} else {
|
||||
console.log("CURAPP: ", curapp)
|
||||
if (curapp.id !== curaction.id) {
|
||||
curaction.app_id = curapp.id
|
||||
//.valueOf()
|
||||
}
|
||||
|
||||
setAuthenticationType(
|
||||
curapp.authentication.type === "oauth2" &&
|
||||
curapp.authentication.redirect_uri !== undefined &&
|
||||
@@ -2713,9 +2720,21 @@ const AngularWorkflow = (defaultprops) => {
|
||||
curaction.parameters[key].options[0];
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
console.log("Should check APP if it has the same params as ACTION")
|
||||
for (var key in curapp.actions) {
|
||||
const tmpaction = curapp.actions[key]
|
||||
if (tmpaction.name === curaction.name) {
|
||||
console.log("Found action - needs change?", tmpaction)
|
||||
if (tmpaction.parameters !== undefined && tmpaction.parameters !== null && tmpaction.parameters.length > 0) {
|
||||
curaction.parameters = JSON.parse(JSON.stringify(tmpaction.parameters))
|
||||
}
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
console.log("ACTION: ", curaction)
|
||||
console.log("ACTION CLICK: ", curaction)
|
||||
setSelectedApp(curapp);
|
||||
setSelectedAction(curaction);
|
||||
|
||||
|
||||
@@ -3792,8 +3792,8 @@ const AppCreator = (defaultprops) => {
|
||||
}
|
||||
|
||||
// Found that dashes in the URL doesn't work
|
||||
parsedurl = parsedurl.replace("-", "_")
|
||||
console.log("Actions: ", actions)
|
||||
//parsedurl = parsedurl.replace("-", "_")
|
||||
//console.log("Actions: ", actions)
|
||||
|
||||
if (baseUrl.length === 0 && parsedurl.includes("http")) {
|
||||
const newurl = new URL(encodeURI(parsedurl))
|
||||
|
||||
@@ -70,7 +70,72 @@ export const FixName = (name) => {
|
||||
return newAppname;
|
||||
};
|
||||
|
||||
// Takes input of e.g. $node.data.#.asd and a matching value from a json blob
|
||||
// Returns
|
||||
export const FindJsonPath = (path, inputdata) => {
|
||||
const splitkey = ".";
|
||||
var parsedValues = [];
|
||||
|
||||
if (inputdata === undefined || inputdata === null) {
|
||||
return inputdata
|
||||
}
|
||||
|
||||
if (typeof inputdata !== "object") {
|
||||
return inputdata
|
||||
}
|
||||
|
||||
var keysplit = path.split(splitkey)
|
||||
if (path.startsWith("$") && keysplit.length > 1) {
|
||||
keysplit = keysplit.slice(1,)
|
||||
}
|
||||
|
||||
if (keysplit.length === 0) {
|
||||
return inputdata
|
||||
}
|
||||
|
||||
// FIXME: Check list - always getting FIRST item, not digging too deep.
|
||||
// If object, send further
|
||||
if (keysplit[0].includes("#")) {
|
||||
if (Object.prototype.toString.call(inputdata) === '[object Array]') {
|
||||
if (inputdata.length === 0) {
|
||||
return ""
|
||||
} else {
|
||||
|
||||
// Fix the list
|
||||
if (keysplit.length === 1) {
|
||||
return inputdata[0]
|
||||
} else {
|
||||
const joinedsplit = keysplit.slice(1,).join(".")
|
||||
return FindJsonPath(joinedsplit, inputdata[0])
|
||||
}
|
||||
}
|
||||
} else {
|
||||
return ""
|
||||
}
|
||||
}
|
||||
|
||||
for (const [key, value] of Object.entries(inputdata)) {
|
||||
|
||||
if (key === keysplit[0]) {
|
||||
|
||||
// Return if no more keys
|
||||
// Else, dig deeper
|
||||
if (keysplit.length === 1) {
|
||||
return value
|
||||
} else {
|
||||
const joinedsplit = keysplit.slice(1,).join(".")
|
||||
return FindJsonPath(joinedsplit, value)
|
||||
}
|
||||
} else {
|
||||
//console.log("N: ", key)
|
||||
}
|
||||
}
|
||||
|
||||
return inputdata
|
||||
}
|
||||
|
||||
// Parses JSON data into keys that can be used everywhere :)
|
||||
// Reverse of this is FindJsonPath
|
||||
export const GetParsedPaths = (inputdata, basekey) => {
|
||||
const splitkey = ".";
|
||||
var parsedValues = [];
|
||||
@@ -92,7 +157,6 @@ export const GetParsedPaths = (inputdata, basekey) => {
|
||||
|
||||
// Handle direct loop!
|
||||
if (!isNaN(key) && basekey === "") {
|
||||
console.log("Handling direct loop.");
|
||||
parsedValues.push({
|
||||
type: "object",
|
||||
name: "Node",
|
||||
|
||||
Reference in New Issue
Block a user