Added description reader for actions
This commit is contained in:
@@ -170,6 +170,7 @@ const ParsedAction = (props) => {
|
|||||||
const [activateHidingBody, setActivateHidingBody] = React.useState(false);
|
const [activateHidingBody, setActivateHidingBody] = React.useState(false);
|
||||||
const [codedata, setcodedata] = React.useState("");
|
const [codedata, setcodedata] = React.useState("");
|
||||||
const [fieldCount, setFieldCount] = React.useState(0);
|
const [fieldCount, setFieldCount] = React.useState(0);
|
||||||
|
const [hiddenDescription, setHiddenDescription] = React.useState(true);
|
||||||
|
|
||||||
const keywords = [
|
const keywords = [
|
||||||
"len(",
|
"len(",
|
||||||
@@ -978,6 +979,9 @@ const ParsedAction = (props) => {
|
|||||||
return helperText
|
return helperText
|
||||||
}
|
}
|
||||||
|
|
||||||
|
console.log("D: ", selectedAction)
|
||||||
|
console.log("DESC: ", selectedAction.description)
|
||||||
|
console.log("DESC2: ", selectedApp.description)
|
||||||
|
|
||||||
// FIXME: Issue #40 - selectedActionParameters not reset
|
// FIXME: Issue #40 - selectedActionParameters not reset
|
||||||
if (
|
if (
|
||||||
@@ -987,7 +991,22 @@ const ParsedAction = (props) => {
|
|||||||
var authWritten = false;
|
var authWritten = false;
|
||||||
return (
|
return (
|
||||||
<div style={{ marginTop: hideExtraTypes ? 10 : 30 }}>
|
<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) => {
|
{selectedActionParameters.map((data, count) => {
|
||||||
if (data.variant === "") {
|
if (data.variant === "") {
|
||||||
data.variant = "STATIC_VALUE";
|
data.variant = "STATIC_VALUE";
|
||||||
@@ -2665,7 +2684,7 @@ const ParsedAction = (props) => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
var newActiondescription = data.description;
|
var newActiondescription = data.description;
|
||||||
console.log("DESC: ", newActiondescription)
|
//console.log("DESC: ", newActiondescription)
|
||||||
if (
|
if (
|
||||||
data.description === undefined || data.description === null
|
data.description === undefined || data.description === null
|
||||||
) {
|
) {
|
||||||
@@ -2756,20 +2775,18 @@ const ParsedAction = (props) => {
|
|||||||
</Select>
|
</Select>
|
||||||
: null*/}
|
: null*/}
|
||||||
|
|
||||||
{selectedAction.description !== undefined &&
|
{selectedAction.description !== undefined && selectedAction.description !== null && selectedAction.description.length > 0 && hideExtraTypes !== true && hiddenDescription === false ? (
|
||||||
selectedAction.description.length > 0 &&
|
<div
|
||||||
hideExtraTypes !== true ? (
|
style={{
|
||||||
<div
|
marginTop: 10,
|
||||||
style={{
|
marginBottom: 10,
|
||||||
marginTop: 10,
|
maxHeight: 60,
|
||||||
marginBottom: 10,
|
overflow: "hidden",
|
||||||
maxHeight: 60,
|
}}
|
||||||
overflow: "hidden",
|
>
|
||||||
}}
|
{selectedAction.description}
|
||||||
>
|
</div>
|
||||||
{selectedAction.description}
|
) : null}
|
||||||
</div>
|
|
||||||
) : null}
|
|
||||||
|
|
||||||
<div
|
<div
|
||||||
style={{
|
style={{
|
||||||
|
|||||||
@@ -2613,6 +2613,28 @@ const AngularWorkflow = (props) => {
|
|||||||
console.log("BUTTON! Find parent from: ", eventTarget)
|
console.log("BUTTON! Find parent from: ", eventTarget)
|
||||||
if (eventTarget.data("isButton") === true) {
|
if (eventTarget.data("isButton") === true) {
|
||||||
console.log("ACTUALLY A BUTTON!")
|
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 (
|
if (
|
||||||
@@ -2739,11 +2761,14 @@ const AngularWorkflow = (props) => {
|
|||||||
setLastSaved(false);
|
setLastSaved(false);
|
||||||
const node = event.target;
|
const node = event.target;
|
||||||
const nodedata = event.target.data();
|
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)
|
console.log("Returning because node is not valid: ", nodedata)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
//}
|
||||||
}
|
}
|
||||||
|
|
||||||
//parsedApp.data.finished = true;
|
//parsedApp.data.finished = true;
|
||||||
@@ -4800,6 +4825,7 @@ const AngularWorkflow = (props) => {
|
|||||||
const actionLabel = getNextActionName(app.name);
|
const actionLabel = getNextActionName(app.name);
|
||||||
var parameters = null;
|
var parameters = null;
|
||||||
var example = "";
|
var example = "";
|
||||||
|
var description = ""
|
||||||
|
|
||||||
if (
|
if (
|
||||||
app.actions[0].parameters !== null &&
|
app.actions[0].parameters !== null &&
|
||||||
@@ -4807,6 +4833,7 @@ const AngularWorkflow = (props) => {
|
|||||||
) {
|
) {
|
||||||
parameters = app.actions[0].parameters;
|
parameters = app.actions[0].parameters;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (
|
if (
|
||||||
app.actions[0].returns.example !== undefined &&
|
app.actions[0].returns.example !== undefined &&
|
||||||
app.actions[0].returns.example !== null &&
|
app.actions[0].returns.example !== null &&
|
||||||
@@ -4815,20 +4842,31 @@ const AngularWorkflow = (props) => {
|
|||||||
example = app.actions[0].returns.example;
|
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 =
|
const parsedEnvironments =
|
||||||
environments === null || environments === []
|
environments === null || environments === []
|
||||||
? "cloud"
|
? "cloud"
|
||||||
: environments[defaultEnvironmentIndex] === undefined
|
: environments[defaultEnvironmentIndex] === undefined
|
||||||
? "cloud"
|
? "cloud"
|
||||||
: environments[defaultEnvironmentIndex].Name;
|
: environments[defaultEnvironmentIndex].Name;
|
||||||
|
|
||||||
const newAppData = {
|
const newAppData = {
|
||||||
app_name: app.name,
|
app_name: app.name,
|
||||||
app_version: app.app_version,
|
app_version: app.app_version,
|
||||||
app_id: app.id,
|
app_id: app.id,
|
||||||
sharing: app.sharing,
|
sharing: app.sharing,
|
||||||
private_id: app.private_id,
|
private_id: app.private_id,
|
||||||
|
description: description,
|
||||||
environment: parsedEnvironments,
|
environment: parsedEnvironments,
|
||||||
errors: [],
|
errors: [],
|
||||||
|
finished: false,
|
||||||
id_: newNodeId,
|
id_: newNodeId,
|
||||||
_id_: newNodeId,
|
_id_: newNodeId,
|
||||||
id: newNodeId,
|
id: newNodeId,
|
||||||
@@ -5158,6 +5196,10 @@ const AngularWorkflow = (props) => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const setNewSelectedAction = (e) => {
|
const setNewSelectedAction = (e) => {
|
||||||
|
if (selectedApp.actions === undefined || selectedApp.actions === null) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
const newaction = selectedApp.actions.find(
|
const newaction = selectedApp.actions.find(
|
||||||
(a) => a.name === e.target.value
|
(a) => a.name === e.target.value
|
||||||
);
|
);
|
||||||
@@ -5216,6 +5258,14 @@ const AngularWorkflow = (props) => {
|
|||||||
newSelectedAction.example = newaction.returns.example;
|
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
|
// FIXME - this is broken sometimes lol
|
||||||
//var env = environments.find(a => a.Name === newaction.environment)
|
//var env = environments.find(a => a.Name === newaction.environment)
|
||||||
//if ((!env || env === undefined) && selectedAction.environment === undefined ) {
|
//if ((!env || env === undefined) && selectedAction.environment === undefined ) {
|
||||||
|
|||||||
Reference in New Issue
Block a user