diff --git a/frontend/src/components/ParsedAction.jsx b/frontend/src/components/ParsedAction.jsx index d4e27bcc..e5d6ae55 100644 --- a/frontend/src/components/ParsedAction.jsx +++ b/frontend/src/components/ParsedAction.jsx @@ -170,6 +170,7 @@ const ParsedAction = (props) => { const [activateHidingBody, setActivateHidingBody] = React.useState(false); const [codedata, setcodedata] = React.useState(""); const [fieldCount, setFieldCount] = React.useState(0); + const [hiddenDescription, setHiddenDescription] = React.useState(true); const keywords = [ "len(", @@ -978,6 +979,9 @@ const ParsedAction = (props) => { return helperText } + console.log("D: ", selectedAction) + console.log("DESC: ", selectedAction.description) + console.log("DESC2: ", selectedApp.description) // FIXME: Issue #40 - selectedActionParameters not reset if ( @@ -987,7 +991,22 @@ const ParsedAction = (props) => { var authWritten = false; return (
- Parameters + + + {selectedActionParameters.map((data, count) => { if (data.variant === "") { data.variant = "STATIC_VALUE"; @@ -2665,7 +2684,7 @@ const ParsedAction = (props) => { } var newActiondescription = data.description; - console.log("DESC: ", newActiondescription) + //console.log("DESC: ", newActiondescription) if ( data.description === undefined || data.description === null ) { @@ -2756,20 +2775,18 @@ const ParsedAction = (props) => { : null*/} - {selectedAction.description !== undefined && - selectedAction.description.length > 0 && - hideExtraTypes !== true ? ( -
- {selectedAction.description} -
- ) : null} + {selectedAction.description !== undefined && selectedAction.description !== null && selectedAction.description.length > 0 && hideExtraTypes !== true && hiddenDescription === false ? ( +
+ {selectedAction.description} +
+ ) : null}
{ console.log("BUTTON! Find parent from: ", eventTarget) if (eventTarget.data("isButton") === true) { console.log("ACTUALLY A BUTTON!") + const parentNode = cy.getElementById(eventTarget.data("attachedTo")) + event.target.remove() + console.log("Setting it to parentnode: ", parentNode.data()) + if (parentNode !== undefined && parentNode !== null) { + //event.target.data("target", eventTarget.data("attachedTo")) + + const newEdgeUuid = uuidv4() + const newcybranch = { + source: event.target.data("source"), + target: eventTarget.data("attachedTo"), + _id: newEdgeUuid, + id: newEdgeUuid, + hasErrors: event.target.data("hasErrors"), + }; + + const edgeToBeAdded = { + group: "edges", + data: newcybranch, + } + + cy.add(edgeToBeAdded); + } } if ( @@ -2739,11 +2761,14 @@ const AngularWorkflow = (props) => { setLastSaved(false); const node = event.target; const nodedata = event.target.data(); - if (nodedata.finished === false || - (nodedata.id !== undefined && nodedata.is_valid === undefined) + + if (nodedata.finished === false || (nodedata.id !== undefined && nodedata.is_valid === undefined) ) { + //if (nodedata.app_id === undefined) { console.log("Returning because node is not valid: ", nodedata) return; + + //} } //parsedApp.data.finished = true; @@ -4800,6 +4825,7 @@ const AngularWorkflow = (props) => { const actionLabel = getNextActionName(app.name); var parameters = null; var example = ""; + var description = "" if ( app.actions[0].parameters !== null && @@ -4807,6 +4833,7 @@ const AngularWorkflow = (props) => { ) { parameters = app.actions[0].parameters; } + if ( app.actions[0].returns.example !== undefined && app.actions[0].returns.example !== null && @@ -4815,20 +4842,31 @@ const AngularWorkflow = (props) => { example = app.actions[0].returns.example; } + if ( + app.actions[0].description !== undefined && + app.actions[0].description !== null && + app.actions[0].description.length > 0 + ) { + description = app.actions[0].description + } + const parsedEnvironments = environments === null || environments === [] ? "cloud" : environments[defaultEnvironmentIndex] === undefined ? "cloud" : environments[defaultEnvironmentIndex].Name; + const newAppData = { app_name: app.name, app_version: app.app_version, app_id: app.id, sharing: app.sharing, private_id: app.private_id, + description: description, environment: parsedEnvironments, errors: [], + finished: false, id_: newNodeId, _id_: newNodeId, id: newNodeId, @@ -5158,6 +5196,10 @@ const AngularWorkflow = (props) => { }; const setNewSelectedAction = (e) => { + if (selectedApp.actions === undefined || selectedApp.actions === null) { + return + } + const newaction = selectedApp.actions.find( (a) => a.name === e.target.value ); @@ -5216,6 +5258,14 @@ const AngularWorkflow = (props) => { newSelectedAction.example = newaction.returns.example; } + if ( + newaction.description !== undefined && + newaction.description !== null && + newaction.description.length > 0 + ) { + newSelectedAction.description = newaction.description + } + // FIXME - this is broken sometimes lol //var env = environments.find(a => a.Name === newaction.environment) //if ((!env || env === undefined) && selectedAction.environment === undefined ) {