#269: Fixed subflow issues
This commit is contained in:
@@ -50,6 +50,34 @@ function useWindowSize() {
|
|||||||
return size;
|
return size;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function removeParam(key, sourceURL) {
|
||||||
|
if (sourceURL === undefined) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
var rtn = sourceURL.split("?")[0],
|
||||||
|
param,
|
||||||
|
params_arr = [],
|
||||||
|
queryString = (sourceURL.indexOf("?") !== -1) ? sourceURL.split("?")[1] : "";
|
||||||
|
|
||||||
|
if (queryString !== "") {
|
||||||
|
params_arr = queryString.split("&");
|
||||||
|
for (var i = params_arr.length - 1; i >= 0; i -= 1) {
|
||||||
|
param = params_arr[i].split("=")[0];
|
||||||
|
if (param === key) {
|
||||||
|
params_arr.splice(i, 1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
rtn = rtn + "?" + params_arr.join("&");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (rtn === "?") {
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
|
return rtn;
|
||||||
|
}
|
||||||
|
|
||||||
const splitter = "|~|"
|
const splitter = "|~|"
|
||||||
//const referenceUrl = "https://shuffler.io/functions/webhooks/"
|
//const referenceUrl = "https://shuffler.io/functions/webhooks/"
|
||||||
//const referenceUrl = window.location.origin+"/api/v1/hooks/"
|
//const referenceUrl = window.location.origin+"/api/v1/hooks/"
|
||||||
@@ -98,6 +126,7 @@ const AngularWorkflow = (props) => {
|
|||||||
const [rightSideBarOpen, setRightSideBarOpen] = React.useState(false)
|
const [rightSideBarOpen, setRightSideBarOpen] = React.useState(false)
|
||||||
const [showSkippedActions, setShowSkippedActions] = React.useState(false)
|
const [showSkippedActions, setShowSkippedActions] = React.useState(false)
|
||||||
const [lastExecution, setLastExecution] = React.useState("")
|
const [lastExecution, setLastExecution] = React.useState("")
|
||||||
|
const [curpath, setCurpath] = useState(typeof window === 'undefined' || window.location === undefined ? "" : window.location.pathname)
|
||||||
|
|
||||||
// 0 = normal, 1 = just done, 2 = normal
|
// 0 = normal, 1 = just done, 2 = normal
|
||||||
const [savingState, setSavingState] = React.useState(0)
|
const [savingState, setSavingState] = React.useState(0)
|
||||||
@@ -321,7 +350,7 @@ const AngularWorkflow = (props) => {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
const getWorkflowExecution = (id) => {
|
const getWorkflowExecution = (id, execution_id) => {
|
||||||
fetch(globalUrl+"/api/v1/workflows/"+id+"/executions", {
|
fetch(globalUrl+"/api/v1/workflows/"+id+"/executions", {
|
||||||
method: 'GET',
|
method: 'GET',
|
||||||
headers: {
|
headers: {
|
||||||
@@ -343,13 +372,19 @@ const AngularWorkflow = (props) => {
|
|||||||
setWorkflowExecutions(responseJson)
|
setWorkflowExecutions(responseJson)
|
||||||
|
|
||||||
const cursearch = typeof window === 'undefined' || window.location === undefined ? "" : window.location.search
|
const cursearch = typeof window === 'undefined' || window.location === undefined ? "" : window.location.search
|
||||||
const tmpView = new URLSearchParams(cursearch).get("execution_id")
|
var tmpView = new URLSearchParams(cursearch).get("execution_id")
|
||||||
|
if (execution_id !== undefined && execution_id !== null && execution_id.length > 0 && (tmpView === undefined || tmpView === null || tmpView.length === 0)) {
|
||||||
|
tmpView = execution_id
|
||||||
|
}
|
||||||
|
|
||||||
if (tmpView !== undefined && tmpView !== null && tmpView.length > 0) {
|
if (tmpView !== undefined && tmpView !== null && tmpView.length > 0) {
|
||||||
//console.log("SHOW EXECUTION ", tmpView)
|
|
||||||
const execution = responseJson.find(data => data.execution_id === tmpView)
|
const execution = responseJson.find(data => data.execution_id === tmpView)
|
||||||
if (execution !== null && execution !== undefined) {
|
if (execution !== null && execution !== undefined) {
|
||||||
setExecutionData(execution)
|
setExecutionData(execution)
|
||||||
setExecutionModalView(1)
|
setExecutionModalView(1)
|
||||||
|
|
||||||
|
const newitem = removeParam("execution_id", cursearch)
|
||||||
|
props.history.push(curpath+newitem)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -596,12 +631,12 @@ const AngularWorkflow = (props) => {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
getWorkflowExecution(props.match.params.key)
|
getWorkflowExecution(props.match.params.key, "")
|
||||||
} else if (responseJson.status === "FINISHED") {
|
} else if (responseJson.status === "FINISHED") {
|
||||||
console.log("STOPPING BECAUSE ITS OVAH!")
|
console.log("STOPPING BECAUSE ITS OVAH!")
|
||||||
setExecutionRunning(false)
|
setExecutionRunning(false)
|
||||||
stop()
|
stop()
|
||||||
getWorkflowExecution(props.match.params.key)
|
getWorkflowExecution(props.match.params.key, "")
|
||||||
setUpdate(Math.random())
|
setUpdate(Math.random())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1528,7 +1563,7 @@ const AngularWorkflow = (props) => {
|
|||||||
getApps()
|
getApps()
|
||||||
getAppAuthentication()
|
getAppAuthentication()
|
||||||
getEnvironments()
|
getEnvironments()
|
||||||
getWorkflowExecution(props.match.params.key)
|
getWorkflowExecution(props.match.params.key, "")
|
||||||
getAvailableWorkflows(-1)
|
getAvailableWorkflows(-1)
|
||||||
getSettings()
|
getSettings()
|
||||||
|
|
||||||
@@ -1536,6 +1571,9 @@ const AngularWorkflow = (props) => {
|
|||||||
const tmpView = new URLSearchParams(cursearch).get("view")
|
const tmpView = new URLSearchParams(cursearch).get("view")
|
||||||
if (tmpView !== undefined && tmpView !== null && tmpView === "executions") {
|
if (tmpView !== undefined && tmpView !== null && tmpView === "executions") {
|
||||||
setExecutionModalOpen(true)
|
setExecutionModalOpen(true)
|
||||||
|
|
||||||
|
const newitem = removeParam("view", cursearch)
|
||||||
|
props.history.push(curpath+newitem)
|
||||||
}
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@@ -5135,7 +5173,17 @@ const AngularWorkflow = (props) => {
|
|||||||
if (e.target.value.id !== workflow.id) {
|
if (e.target.value.id !== workflow.id) {
|
||||||
const startnode = e.target.value.actions.find(action => action.id === e.target.value.start)
|
const startnode = e.target.value.actions.find(action => action.id === e.target.value.start)
|
||||||
if (startnode !== undefined && startnode !== null) {
|
if (startnode !== undefined && startnode !== null) {
|
||||||
|
//ddsetSubworkflowStartnode(innernode)
|
||||||
setSubworkflowStartnode(startnode)
|
setSubworkflowStartnode(startnode)
|
||||||
|
|
||||||
|
try {
|
||||||
|
workflow.triggers[selectedTriggerIndex].parameters[3].value = e.target.value.id
|
||||||
|
} catch {
|
||||||
|
workflow.triggers[selectedTriggerIndex].parameters[3] = {
|
||||||
|
"name": "startnode",
|
||||||
|
"value": e.target.value.id,
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
console.log("STARTNODE: ", startnode)
|
console.log("STARTNODE: ", startnode)
|
||||||
}
|
}
|
||||||
@@ -6236,7 +6284,7 @@ const AngularWorkflow = (props) => {
|
|||||||
<span>
|
<span>
|
||||||
<Button color="primary" style={{height: 50, marginLeft: 10, }} variant="outlined" onClick={() => {
|
<Button color="primary" style={{height: 50, marginLeft: 10, }} variant="outlined" onClick={() => {
|
||||||
setExecutionModalOpen(true)
|
setExecutionModalOpen(true)
|
||||||
getWorkflowExecution(props.match.params.key)
|
getWorkflowExecution(props.match.params.key, "")
|
||||||
}}>
|
}}>
|
||||||
<DirectionsRunIcon />
|
<DirectionsRunIcon />
|
||||||
</Button>
|
</Button>
|
||||||
@@ -6482,7 +6530,7 @@ const AngularWorkflow = (props) => {
|
|||||||
style={{borderRadius: "0px"}}
|
style={{borderRadius: "0px"}}
|
||||||
variant="outlined"
|
variant="outlined"
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
getWorkflowExecution(props.match.params.key)
|
getWorkflowExecution(props.match.params.key, "")
|
||||||
}} color="primary">
|
}} color="primary">
|
||||||
<CachedIcon style={{marginRight: 10}}/>
|
<CachedIcon style={{marginRight: 10}}/>
|
||||||
Refresh executions
|
Refresh executions
|
||||||
@@ -6562,7 +6610,7 @@ const AngularWorkflow = (props) => {
|
|||||||
<span style={{color: "rgba(255,255,255,0.5)", display: "flex"}} onClick={() => {
|
<span style={{color: "rgba(255,255,255,0.5)", display: "flex"}} onClick={() => {
|
||||||
setExecutionRunning(false)
|
setExecutionRunning(false)
|
||||||
stop()
|
stop()
|
||||||
getWorkflowExecution(props.match.params.key)
|
getWorkflowExecution(props.match.params.key, "")
|
||||||
setExecutionModalView(0)
|
setExecutionModalView(0)
|
||||||
setLastExecution(executionData.execution_id)
|
setLastExecution(executionData.execution_id)
|
||||||
}}>
|
}}>
|
||||||
@@ -6600,7 +6648,14 @@ const AngularWorkflow = (props) => {
|
|||||||
{executionData.execution_source !== undefined && executionData.execution_source !== null && executionData.execution_source.length > 0 && executionData.execution_source !== "default" ?
|
{executionData.execution_source !== undefined && executionData.execution_source !== null && executionData.execution_source.length > 0 && executionData.execution_source !== "default" ?
|
||||||
<div>
|
<div>
|
||||||
<b>Source: </b>{executionData.execution_parent !== null && executionData.execution_parent !== undefined && executionData.execution_parent.length > 0 ?
|
<b>Source: </b>{executionData.execution_parent !== null && executionData.execution_parent !== undefined && executionData.execution_parent.length > 0 ?
|
||||||
<a rel="norefferer" href={`/workflows/${executionData.execution_source}?view=executions&execution_id=${executionData.execution_parent}`} target="_blank" style={{textDecoration: "none", color: "#f85a3e"}}>Parent Workflow</a>
|
executionData.execution_source === props.match.params.key ?
|
||||||
|
<span style={{cursor: "pointer", color: "#f85a3e"}} onClick={(event) => {
|
||||||
|
getWorkflowExecution(props.match.params.key, executionData.execution_parent)
|
||||||
|
}}>
|
||||||
|
Parent Execution
|
||||||
|
</span>
|
||||||
|
:
|
||||||
|
<a rel="norefferer" href={`/workflows/${executionData.execution_source}?view=executions&execution_id=${executionData.execution_parent}`} target="_blank" style={{textDecoration: "none", color: "#f85a3e"}}>Parent Workflow</a>
|
||||||
:
|
:
|
||||||
executionData.execution_source
|
executionData.execution_source
|
||||||
}
|
}
|
||||||
@@ -6659,7 +6714,7 @@ const AngularWorkflow = (props) => {
|
|||||||
const statusColor = data.status === "FINISHED" || data.status === "SUCCESS" ? "green" : data.status === "ABORTED" || data.status === "FAILURE" ? "red" : "orange"
|
const statusColor = data.status === "FINISHED" || data.status === "SUCCESS" ? "green" : data.status === "ABORTED" || data.status === "FAILURE" ? "red" : "orange"
|
||||||
|
|
||||||
var imgSrc = curapp === undefined ? "" : curapp.large_image
|
var imgSrc = curapp === undefined ? "" : curapp.large_image
|
||||||
if (imgSrc.length === 0) {
|
if (imgSrc.length === 0 && workflow.actions !== undefined && workflow.actions !== null) {
|
||||||
// Look for the node in the workflow
|
// Look for the node in the workflow
|
||||||
const action = workflow.actions.find(action => action.id === data.action.id)
|
const action = workflow.actions.find(action => action.id === data.action.id)
|
||||||
if (action !== undefined && action !== null) {
|
if (action !== undefined && action !== null) {
|
||||||
@@ -6723,7 +6778,15 @@ const AngularWorkflow = (props) => {
|
|||||||
{data.action.app_name === "shuffle-subflow" && validate.result.success !== undefined && validate.result.success === true ?
|
{data.action.app_name === "shuffle-subflow" && validate.result.success !== undefined && validate.result.success === true ?
|
||||||
<span>
|
<span>
|
||||||
{validate.valid && data.action.parameters !== undefined && data.action.parameters !== null ?
|
{validate.valid && data.action.parameters !== undefined && data.action.parameters !== null ?
|
||||||
<a rel="norefferer" href={`/workflows/${data.action.parameters[0].value}?view=executions&execution_id=${validate.result.execution_id}`} target="_blank" style={{textDecoration: "none", color: "#f85a3e"}}>See subflow execution</a>
|
data.action.parameters[0].value === props.match.params.key ?
|
||||||
|
<span style={{cursor: "pointer", color: "#f85a3e"}} onClick={(event) => {
|
||||||
|
getWorkflowExecution(props.match.params.key, validate.result.execution_id)
|
||||||
|
}}>
|
||||||
|
See sub-execution
|
||||||
|
</span>
|
||||||
|
:
|
||||||
|
<a rel="norefferer" href={`/workflows/${data.action.parameters[0].value}?view=executions&execution_id=${validate.result.execution_id}`} target="_blank" style={{textDecoration: "none", color: "#f85a3e"}} onClick={(event) => {
|
||||||
|
}}>See subflow execution</a>
|
||||||
:
|
:
|
||||||
"TBD: Load subexecution result for"
|
"TBD: Load subexecution result for"
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user