Added description reader for actions

This commit is contained in:
frikky
2021-12-16 03:41:43 +01:00
parent ae9bc32a47
commit 3f033bf732
2 changed files with 85 additions and 18 deletions
+33 -16
View File
@@ -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 (
<div style={{ marginTop: hideExtraTypes ? 10 : 30 }}>
<b>Parameters</b>
<Tooltip
color="secondary"
title={"Click to learn more"}
placement="top"
>
<Button
variant="text"
color="secondary"
style={{textTransform: "none",}}
onClick={() => {
setHiddenDescription(!hiddenDescription)
}}
>
<b>Parameters</b>
</Button>
</Tooltip>
{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) => {
</Select>
: null*/}
{selectedAction.description !== undefined &&
selectedAction.description.length > 0 &&
hideExtraTypes !== true ? (
<div
style={{
marginTop: 10,
marginBottom: 10,
maxHeight: 60,
overflow: "hidden",
}}
>
{selectedAction.description}
</div>
) : null}
{selectedAction.description !== undefined && selectedAction.description !== null && selectedAction.description.length > 0 && hideExtraTypes !== true && hiddenDescription === false ? (
<div
style={{
marginTop: 10,
marginBottom: 10,
maxHeight: 60,
overflow: "hidden",
}}
>
{selectedAction.description}
</div>
) : null}
<div
style={{
+52 -2
View File
@@ -2613,6 +2613,28 @@ const AngularWorkflow = (props) => {
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 ) {