showResult = replaceAll(showResult, " None", " \"None\"");
console.log(showResult)
showResult =
} else {
// FIXME - have everything parsed as json, either just for frontend
// or in the backend
/*
const newdata = {"result": data.result}
showResult =
*/
}
console.log(data)
return (
{}}>
Status : {data.status}
App: {data.action.app_name}, Version: {data.action.app_version}
Action: {data.action.name}, Environment: {data.action.environment}
Started: {t.toISOString()}
{showResult}
)
}
const resultsHandler = Object.getOwnPropertyNames(selectedExecution).length > 0 && selectedExecution.results !== null ?
{selectedExecution.results.sort((a, b) => a.started_at - b.started_at).map(data => {
return (
resultsPaper(data)
)
})}
:
No results yet
const resultsLength = Object.getOwnPropertyNames(selectedExecution).length > 0 && selectedExecution.results !== null ? selectedExecution.results.length : 0
const ExecutionDetails = () => {
var starttime = new Date(selectedExecution.started_at*1000)
var endtime = new Date(selectedExecution.started_at*1000)
console.log(selectedExecution)
const arg = selectedExecution.execution_argument !== undefined && selectedExecution.execution_argument.length > 0 ?
Argument: {selectedExecution.execution_argument}
: null
/*
ID: {selectedExecution.execution_id}
*/
if (Object.getOwnPropertyNames(selectedExecution).length > 0 && selectedExecution.workflow.actions !== null) {
return (
Actions: {selectedExecution.workflow.actions.length}
Results: {resultsLength}
Status: {selectedExecution.status}
Starttime: {starttime.toISOString()}
Finished: {endtime.toISOString()}
Result: {selectedExecution.result}
Last node: {selectedExecution.last_node}
{arg}
{resultsHandler}
)
}
return (
There are no executiondetails yet. Click "execute" to run your first one.
)
}
const ExecutionsView = () => {
if (workflowExecutions.length > 0) {
const sortedWorkflows = workflowExecutions.sort((a, b) => a.started_at - b.started_at).reverse()
return (
{sortedWorkflows.map(data => {
return (
executionPaper(data)
)
})}
)
}
return (
There are no executions for this workflow yet
)
}
const setNewWorkflow = () => {
if (newWorkflowName.length === 0) {
return
}
var workflowdata = {
"name": newWorkflowName,
"description": newWorkflowDescription,
}
fetch(globalUrl+"/api/v1/workflows", {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'Accept': 'application/json',
},
body: JSON.stringify(workflowdata),
credentials: "include",
})
.then((response) => {
if (response.status !== 200) {
console.log("Status not 200 for workflows :O!")
return
}
return response.json()
})
.then((responseJson) => {
window.location.pathname = "/workflows/"+responseJson["id"]
})
.catch(error => {
alert.error(error.toString())
});
}
const modalView = modalOpen ?
{setModalOpen(false)}}
PaperProps={{
style: {
backgroundColor: surfaceColor,
color: "white",
minWidth: "800px",
},
}}
>
New workflow
setNewWorkflowname(event.target.value)}
InputProps={{
style:{
color: "white",
},
}}
color="primary"
placeholder="Name"
margin="dense"
fullWidth
/>
setNewWorkflowDescription(event.target.value)}
InputProps={{
style:{
color: "white",
},
}}
color="primary"
placeholder="Description"
margin="dense"
fullWidth
/>
setModalOpen(false)} color="primary">
Cancel
{
setNewWorkflow()
setModalOpen(false)
}} color="primary">
Submit
: null
const viewSize = {
workflowView: 1,
executionsView: 1,
executionResults: 2,
}
const workflowViewStyle = {
flex: viewSize.workflowView,
marginLeft: "10px",
marginRight: "10px",
}
if (viewSize.workflowView === 0) {
workflowViewStyle.display = "none"
}
const workflowView = workflows.length > 0 ?
Workflows
setModalOpen(true)}>Import
setModalOpen(true)}>New
{workflows.map(data => {
return (
)
})}
Executions
{alert.info("Refreshing executions"); getWorkflowExecution(selectedWorkflow.id)}}>Refresh
Execution Timeline
Collapse results
control={
{setCollapseJson(!collapseJson)}} />}
/>
:
Welcome to Shuffle!
Shuffle is a flexible, easy to use, automation framework allowing users to integrate their services and devices to reduce the amount of manual labor required for those tasks. Click here for more information.
If you want to jump straight into it, click the following button to create your first workflow:
setModalOpen(true)}>New workflow
const loadedCheck = isLoaded && isLoggedIn && workflowDone ?
{workflowView}
{modalView}
:
// Maybe use gridview or something, idk
return (
{loadedCheck}
)
}
export default Workflows