Revert "Expand window feature"
This commit is contained in:
@@ -132,7 +132,6 @@ const ParsedAction = (props) => {
|
|||||||
setSelectedResult,
|
setSelectedResult,
|
||||||
selectedAction,
|
selectedAction,
|
||||||
setSelectedApp,
|
setSelectedApp,
|
||||||
selectedTrigger,
|
|
||||||
setSelectedTrigger,
|
setSelectedTrigger,
|
||||||
setSelectedEdge,
|
setSelectedEdge,
|
||||||
setCurrentView,
|
setCurrentView,
|
||||||
@@ -641,7 +640,7 @@ const ParsedAction = (props) => {
|
|||||||
setSelectedActionParameters(newParameters);
|
setSelectedActionParameters(newParameters);
|
||||||
setActionlist(newActionList);
|
setActionlist(newActionList);
|
||||||
}, [workflow.execution_variables,paramUpdate, workflow.workflow_variables, workflowExecutions, workflow, selectedAction, listCache, getParents,setNewSelectedAction]);
|
}, [workflow.execution_variables,paramUpdate, workflow.workflow_variables, workflowExecutions, workflow, selectedAction, listCache, getParents,setNewSelectedAction]);
|
||||||
|
console.log("Selected Action:", selectedAction)
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
selectedNameChange(appActionName)
|
selectedNameChange(appActionName)
|
||||||
|
|
||||||
@@ -1896,78 +1895,6 @@ const ParsedAction = (props) => {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(workflow.triggers !== undefined && workflow.triggers !== null && workflow.triggers.length > 0) {
|
|
||||||
for(let [key,keyval] in Object.entries(workflow.triggers)) {
|
|
||||||
if(workflow.triggers[key].id === selectedTrigger.id) {
|
|
||||||
continue
|
|
||||||
}
|
|
||||||
|
|
||||||
const params = workflow.triggers[key].parameters
|
|
||||||
if (params === null || params === undefined) {
|
|
||||||
continue
|
|
||||||
}
|
|
||||||
|
|
||||||
for (let [subkey, subkeyval] in Object.entries(params)) {
|
|
||||||
const param = workflow.triggers[key].parameters[subkey];
|
|
||||||
if(param.name === "argument" || param.name === "alertinfo"){
|
|
||||||
if (!param.value.includes("$")) {
|
|
||||||
continue
|
|
||||||
}
|
|
||||||
|
|
||||||
// Should have a smarter way of discovering node names
|
|
||||||
// Do regex?
|
|
||||||
// Finding index(es) and replacing at the location
|
|
||||||
//
|
|
||||||
|
|
||||||
try {
|
|
||||||
var cnt = -1
|
|
||||||
var previous = 0
|
|
||||||
while (true) {
|
|
||||||
cnt += 1
|
|
||||||
// Need to make sure e.g. changing the first here doesn't change the 2nd
|
|
||||||
// $change_me
|
|
||||||
// $change_me_2
|
|
||||||
const foundindex = param.value.toLowerCase().indexOf(parsedBaseLabel, previous)
|
|
||||||
if (foundindex === previous && foundindex !== 0) {
|
|
||||||
break
|
|
||||||
}
|
|
||||||
|
|
||||||
if (foundindex >= 0) {
|
|
||||||
previous = foundindex+newname.length
|
|
||||||
// Need to add diff of length to word
|
|
||||||
|
|
||||||
// Check location:
|
|
||||||
// If it's a-zA-Z_ then don't replace
|
|
||||||
if (param.value.length > foundindex+parsedBaseLabel.length) {
|
|
||||||
const regex = /[a-zA-Z0-9_]/g;
|
|
||||||
const match = param.value[foundindex+parsedBaseLabel.length].match(regex);
|
|
||||||
if (match !== null) {
|
|
||||||
continue
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
console.log("Old found: ", workflow.triggers[key].parameters[subkey].value)
|
|
||||||
const extralength = newname.length-parsedBaseLabel.length
|
|
||||||
param.value = param.value.substring(0, foundindex) + newname + param.value.substring(foundindex-extralength+newname.length, param.value.length)
|
|
||||||
|
|
||||||
console.log("New: ", workflow.triggers[key].parameters[subkey].value)
|
|
||||||
} else {
|
|
||||||
break
|
|
||||||
}
|
|
||||||
|
|
||||||
// Break no matter what after 5 replaces. May need to increase
|
|
||||||
if (cnt >= 5) {
|
|
||||||
break
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
} catch (e) {
|
|
||||||
console.log("Failed value replacement based on index: ", e)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
setWorkflow(workflow);
|
setWorkflow(workflow);
|
||||||
setUpdate(Math.random());
|
setUpdate(Math.random());
|
||||||
setPrevActionName(name)
|
setPrevActionName(name)
|
||||||
@@ -3452,13 +3379,7 @@ const ParsedAction = (props) => {
|
|||||||
if (parsedvalue === undefined || parsedvalue === null) {
|
if (parsedvalue === undefined || parsedvalue === null) {
|
||||||
parsedvalue = ""
|
parsedvalue = ""
|
||||||
}
|
}
|
||||||
console.log("Data sending to codeeditor(Action): ", {
|
|
||||||
"name": data.name,
|
|
||||||
"value": parsedvalue,
|
|
||||||
"field_number": count,
|
|
||||||
"actionlist": actionlist,
|
|
||||||
"field_id": clickedFieldId,
|
|
||||||
} )
|
|
||||||
setEditorData({
|
setEditorData({
|
||||||
"name": data.name,
|
"name": data.name,
|
||||||
"value": parsedvalue,
|
"value": parsedvalue,
|
||||||
|
|||||||
@@ -109,7 +109,6 @@ const CodeEditor = (props) => {
|
|||||||
setActiveDialog,
|
setActiveDialog,
|
||||||
fieldname,
|
fieldname,
|
||||||
contentLoading,
|
contentLoading,
|
||||||
selectedTrigger,
|
|
||||||
} = props
|
} = props
|
||||||
|
|
||||||
const [localcodedata, setlocalcodedata] = React.useState(codedata === undefined || codedata === null || codedata.length === 0 ? "" : codedata);
|
const [localcodedata, setlocalcodedata] = React.useState(codedata === undefined || codedata === null || codedata.length === 0 ? "" : codedata);
|
||||||
@@ -437,8 +436,7 @@ const CodeEditor = (props) => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const autoFormat = (input) => {
|
const autoFormat = (input) => {
|
||||||
if(selectedAction && selectedAction.parameters && selectedAction.parameters.length > 0){
|
// Check if it's default too
|
||||||
// Check if it's default too
|
|
||||||
if (validation !== true) {
|
if (validation !== true) {
|
||||||
|
|
||||||
// Should try to automatically fix this input
|
// Should try to automatically fix this input
|
||||||
@@ -477,48 +475,6 @@ const CodeEditor = (props) => {
|
|||||||
if (input !== localcodedata) {
|
if (input !== localcodedata) {
|
||||||
setlocalcodedata(input)
|
setlocalcodedata(input)
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if(selectedTrigger && selectedTrigger.parameters && selectedTrigger.parameters.length > 0){
|
|
||||||
if (validation !== true) {
|
|
||||||
|
|
||||||
// Should try to automatically fix this input
|
|
||||||
console.log("Running AI input fixer")
|
|
||||||
if (aiSubmit !== undefined && parameterName !== undefined && selectedTrigger !== undefined) {
|
|
||||||
|
|
||||||
// Should remove params from selectedAction that aren't parameterName
|
|
||||||
var tmpAction = JSON.parse(JSON.stringify(selectedTrigger))
|
|
||||||
var tmpParams = selectedTrigger.parameters.filter((param) => param.name === parameterName)
|
|
||||||
|
|
||||||
var aiMsg = `Make it valid for trigger ${tmpAction.label} with parameter ${parameterName}: `
|
|
||||||
if (tmpParams.length > 0) {
|
|
||||||
aiMsg += tmpParams[0].value
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
if (localcodedata.startsWith("//")) {
|
|
||||||
aiMsg = localcodedata
|
|
||||||
}
|
|
||||||
|
|
||||||
tmpAction.parameters = tmpParams
|
|
||||||
console.log("Parameters: ", tmpParams.length)
|
|
||||||
|
|
||||||
aiSubmit(aiMsg, tmpAction)
|
|
||||||
}
|
|
||||||
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
try {
|
|
||||||
input = JSON.stringify(JSON.parse(input), null, 4)
|
|
||||||
} catch (e) {
|
|
||||||
console.log("Failed magic JSON stringification: ", e)
|
|
||||||
}
|
|
||||||
|
|
||||||
if (input !== localcodedata) {
|
|
||||||
setlocalcodedata(input)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const findIndex = (line, loc) => {
|
const findIndex = (line, loc) => {
|
||||||
@@ -1846,4 +1802,4 @@ const CodeEditor = (props) => {
|
|||||||
</Dialog>)
|
</Dialog>)
|
||||||
}
|
}
|
||||||
|
|
||||||
export default CodeEditor;
|
export default CodeEditor;
|
||||||
|
|||||||
+1192
-1677
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user