Scheduling works onprem!

This commit is contained in:
frikky
2020-05-20 06:10:32 +02:00
parent ee85e7f267
commit e44c0845d2
6 changed files with 236 additions and 75 deletions
+9 -8
View File
@@ -80,7 +80,6 @@ const splitter = "|~|"
//const referenceUrl = "https://shuffler.io/functions/webhooks/"
//const referenceUrl = window.location.origin+"/api/v1/hooks/"
console.log(window.location)
const AngularWorkflow = (props) => {
const { globalUrl, isLoggedIn, isLoaded } = props;
const referenceUrl = globalUrl+"/api/v1/hooks/"
@@ -1261,11 +1260,11 @@ const AngularWorkflow = (props) => {
//const submitSchedule = (id, name, frequency, executionArg) => {
const submitSchedule = (trigger, triggerindex) => {
const cronSplit = workflow.triggers[triggerindex].parameters[0].value.split("*")
if (cronSplit.length <= 5 || cronSplit.length > 6) {
alert.error("Error: Bad cron, example run every 1 minute: */1 * * * *")
return
}
//const cronSplit = workflow.triggers[triggerindex].parameters[0].value.split("*")
//if (cronSplit.length <= 5 || cronSplit.length > 6) {
// alert.error("Error: Bad cron, example run every 1 minute: */1 * * * *")
// return
//}
if (trigger.name.length <= 0) {
alert.error("Error: name can't be empty")
@@ -3892,7 +3891,7 @@ const AngularWorkflow = (props) => {
if (Object.getOwnPropertyNames(selectedTrigger).length > 0 && workflow.triggers[selectedTriggerIndex] !== undefined) {
if (workflow.triggers[selectedTriggerIndex].parameters === undefined || workflow.triggers[selectedTriggerIndex].parameters === null || workflow.triggers[selectedTriggerIndex].parameters.length === 0) {
workflow.triggers[selectedTriggerIndex].parameters = []
workflow.triggers[selectedTriggerIndex].parameters[0] = {"name": "cron", "value": "*/15 * * * *"}
workflow.triggers[selectedTriggerIndex].parameters[0] = {"name": "cron", "value": "120"}
workflow.triggers[selectedTriggerIndex].parameters[1] = {"name": "execution_argument", "value": '{"example": {"json": "is cool"}}'}
setWorkflow(workflow)
}
@@ -3953,7 +3952,7 @@ const AngularWorkflow = (props) => {
<div style={{marginTop: "20px", marginBottom: "7px", display: "flex"}}>
<div style={{width: "17px", height: "17px", borderRadius: 17 / 2, backgroundColor: "#f85a3e", marginRight: "10px"}}/>
<div style={{flex: "10"}}>
<b>Cron: </b>
<b>Run how often (seconds)? </b>
</div>
</div>
<TextField
@@ -3968,6 +3967,7 @@ const AngularWorkflow = (props) => {
},
}}
fullWidth
disabled={workflow.triggers[selectedTriggerIndex].status === "running"}
defaultValue={workflow.triggers[selectedTriggerIndex].parameters[0].value}
color="primary"
placeholder="defaultValue"
@@ -3992,6 +3992,7 @@ const AngularWorkflow = (props) => {
fontSize: "1em",
},
}}
disabled={workflow.triggers[selectedTriggerIndex].status === "running"}
fullWidth
rows="6"
multiline
+2 -2
View File
@@ -38,12 +38,12 @@ import AlertTemplate from "react-alert-template-basic";
import { positions, Provider } from "react-alert";
// Testing - localhost
//const globalUrl = "http://192.168.3.6:5001"
const globalUrl = "http://192.168.3.6:5001"
console.log("HOST: ", process.env)
// Production - backend proxy forwarding in nginx
const globalUrl = window.location.origin
//const globalUrl = window.location.origin
const surfaceColor = "#27292D"
const inputColor = "#383B40"
+16 -10
View File
@@ -333,18 +333,19 @@ const Workflows = (props) => {
}
return (
<Paper square style={paperAppStyle} onClick={() => {
if (selectedWorkflow.id !== data.id) {
setSelectedWorkflow(data)
getWorkflowExecution(data.id)
}
<Paper square style={paperAppStyle} onClick={(e) => {
}}>
<div style={{marginLeft: "10px", marginTop: "5px", marginBottom: "5px", width: boxWidth, backgroundColor: boxColor}}>
</div>
<Grid container style={{margin: "10px 10px 10px 10px", flex: "1"}}>
<Grid style={{display: "flex", flexDirection: "column", width: "100%"}}>
<Grid item style={{flex: "1", display: "flex"}}>
<div style={{flex: "10"}}>
<div style={{flex: "10",}} onClick={() => {
if (selectedWorkflow.id !== data.id) {
setSelectedWorkflow(data)
getWorkflowExecution(data.id)
}
}}>
<h3 style={{marginBottom: "0px", marginTop: "10px"}}>{data.name}</h3>
</div>
<div style={{flex: "1"}}>
@@ -390,17 +391,22 @@ const Workflows = (props) => {
</Menu>
</div>
</Grid>
<div style={{display: "flex", flex: "1"}}>
<div style={{display: "flex", flex: "1"}} onClick={() => {
if (selectedWorkflow.id !== data.id) {
setSelectedWorkflow(data)
getWorkflowExecution(data.id)
}
}}>
<Grid item style={{flex: "1", justifyContent: "center"}}>
<a href={"/workflows/"+data.id}>
<Tooltip color="primary" title="Edit workflow" placement="bottom">
<Button style={{}} color="primary" variant="outlined" style={{marginRight: 10}} onClick={() => {}}>
<Button style={{}} color="primary" variant="text" style={{marginRight: 10}} onClick={() => {}}>
<EditIcon style={{marginRight: 10}}/> Edit
</Button>
</Tooltip>
</a>
<Tooltip color="primary" title="Execute workflow" placement="bottom">
<Button style={{}} color="primary" variant="outlined" onClick={() => executeWorkflow(data.id)}>
<Button style={{}} color="secondary" variant="text" onClick={() => executeWorkflow(data.id)}>
<PlayArrowIcon />
</Button>
</Tooltip>
@@ -840,7 +846,7 @@ const Workflows = (props) => {
<div style={{flex: viewSize.executionsView, marginLeft: "10px", marginRight: "10px"}}>
<div style={{display: "flex"}}>
<div style={{flex: "10"}}>
<h2>Executions</h2>
<h2>Executions: {selectedWorkflow.name}</h2>
</div>
<div style={{flex: "1"}}>
<Button color="primary" style={{marginTop: "20px"}} variant="outlined" onClick={() => {