Added saving tracker to workflows

This commit is contained in:
frikky
2021-02-18 16:27:35 +01:00
parent bd6f12c562
commit 6d86207c8f
4 changed files with 104 additions and 72 deletions
+1 -1
View File
@@ -538,7 +538,7 @@ class AppBase:
}
try:
print("Parameters: %d" % len(action["parameters"]))
print(action["parameters"])
except KeyError:
action["parameters"] = []
+5 -2
View File
@@ -3135,7 +3135,10 @@ func handleExecution(id string, workflow Workflow, request *http.Request) (Workf
// This one doesn't really matter.
log.Printf("[INFO] Running POST execution with body of length %d", len(string(body)))
a
if body[0] == 34 && body[len(body)-1] == 34 {
body = body[1 : len(body)-1]
}
if body[0] == 34 && body[len(body)-1] == 34 {
body = body[1 : len(body)-1]
}
@@ -6621,7 +6624,7 @@ func iterateAppGithubFolders(fs billy.Filesystem, dir []os.FileInfo, extra strin
if !reservedFound {
buildLaterFirst = append(buildLaterFirst, buildLater)
} else {
log.Printf("\n\n[WARNING] Skipping build of %s to later\n\n", workflowapp.Name)
log.Printf("[WARNING] Skipping build of %s to later", workflowapp.Name)
}
}
}
+50 -63
View File
@@ -4,10 +4,13 @@ import {BrowserView, MobileView} from "react-device-detect";
import {Link} from 'react-router-dom';
import List from '@material-ui/core/List';
import Avatar from '@material-ui/core/Avatar';
import Menu from '@material-ui/core/Menu';
import ListItem from '@material-ui/core/ListItem';
import MenuItem from '@material-ui/core/MenuItem';
import Select from '@material-ui/core/Select';
import Button from '@material-ui/core/Button';
import IconButton from '@material-ui/core/IconButton';
import HomeIcon from '@material-ui/icons/Home';
import PolymerIcon from '@material-ui/icons/Polymer';
import AppsIcon from '@material-ui/icons/Apps';
@@ -27,6 +30,7 @@ const Header = props => {
const [LoginHoverColor, setLoginHoverColor] = useState(hoverOutColor);
const [DocsHoverColor, setDocsHoverColor] = useState(hoverOutColor);
const [HelpHoverColor, setHelpHoverColor] = useState(hoverOutColor);
const [anchorEl, setAnchorEl] = React.useState(null);
const hrefStyle = {
color: hoverOutColor,
@@ -102,6 +106,17 @@ const Header = props => {
setLoginHoverColor(hoverOutColor)
}
const handleClick = (event) => {
setAnchorEl(event.currentTarget);
};
const handleClose = () => {
setAnchorEl(null);
};
// Should be based on some path
const logoCheck = !homePage ? null : null
@@ -182,74 +197,46 @@ const Header = props => {
</List>
</div>
<div style={{flex: "10", display: "flex", flexDirection: "row-reverse"}}>
<List style={{display: 'flex', flexDirection: 'row-reverse'}} component="nav">
<ListItem style={{flex: "1", textAlign: "center"}}>
<div onMouseOver={handleLoginHover} onMouseOut={handleLoginHoverOut} onClick={handleClickLogout} style={{color: LoginHoverColor, cursor: "pointer"}}>
Logout
</div>
</ListItem>
{logoCheck}
<ListItem style={{flex: "1", textAlign: "center"}}>
<IconButton color="primary" style={{marginRight: 15, }} aria-controls="simple-menu" aria-haspopup="true" onClick={(event) => {
setAnchorEl(event.currentTarget);
}}>
<Avatar style={{height: 35, width: 35,}} alt="Your username here" src="" />
</IconButton>
<Menu
id="simple-menu"
anchorEl={anchorEl}
keepMounted
open={Boolean(anchorEl)}
onClose={() => {
handleClose()
}}
>
<MenuItem onClick={(event) => {
event.preventDefault()
handleClose()
}}>
<Link to="/settings" style={hrefStyle}>
<Button
style={{}}
variant="outlined"
color="primary"> Settings</Button>
Settings
</Link>
</ListItem>
{/*
<ListItem>
<Link to="/contact" style={hrefStyle}>
<Button
style={{}}
variant="contained"
color="primary"
>
Contact
</Button>
</Link>
</ListItem>
*/}
</MenuItem>
{userdata === undefined || userdata.admin === undefined || userdata.admin === null || !userdata.admin ? null :
<ListItem>
<MenuItem onClick={(event) => {
event.preventDefault()
handleClose()
}}>
<Link to="/admin" style={hrefStyle}>
<Button
style={{}}
variant="contained"
color="primary"
>
Admin
</Button>
Admin
</Link>
</ListItem>
</MenuItem>
}
{userdata === undefined || userdata.orgs === undefined || userdata.orgs === null || userdata.orgs.length <= 1 ? null :
<ListItem>
<Select
SelectDisplayProps={{
style: {
marginLeft: 10,
}
}}
value={userdata.selected_org}
fullWidth
style={{backgroundColor: theme.palette.surfaceColor, color: "white", height: "50px"}}
onChange={(e) => {
console.log("SET ORG TO ", e.target.value)
}}
>
{userdata.orgs.map(data => {
return (
<MenuItem key={data.id} style={{backgroundColor: theme.palette.inputColor, color: "white"}} value={data}>
{data.name}
</MenuItem>
)
})}
</Select>
</ListItem>
}
</List>
<MenuItem style={{color: "white"}} onClick={(event) => {
event.preventDefault()
handleClose()
handleClickLogout()
}}>
Logout
</MenuItem>
</Menu>
</div>
</div>
@@ -327,7 +314,7 @@ const Header = props => {
// <Divider style={{height: "1px", width: "100%", backgroundColor: "rgb(91, 96, 100)"}}/>
const loadedCheck =
<div style={{minHeight: 68}}>
<div style={{minHeight: 60}}>
<BrowserView>
{loginTextBrowser}
</BrowserView>
+48 -6
View File
@@ -121,6 +121,8 @@ const AngularWorkflow = (props) => {
const [bodyWidth, bodyHeight] = useWindowSize();
const appBarSize = 74
const headerSize = 60
var to_be_copied = ""
const [cystyle, ] = useState(cytoscapestyle)
const [cy, setCy] = React.useState()
@@ -155,6 +157,9 @@ const AngularWorkflow = (props) => {
const [showSkippedActions, setShowSkippedActions] = React.useState(false)
const [lastExecution, setLastExecution] = React.useState("")
// 0 = normal, 1 = just done, 2 = normal
const [savingState, setSavingState] = React.useState(0)
const [selectedResult, setSelectedResult] = React.useState({})
const [codeModalOpen, setCodeModalOpen] = React.useState(false);
@@ -646,6 +651,7 @@ const AngularWorkflow = (props) => {
const saveWorkflow = (curworkflow) => {
var success = false
setSavingState(2)
// This might not be the right course of action, but seems logical, as items could be running already
// Makes it possible to update with a version in current render
@@ -654,7 +660,7 @@ const AngularWorkflow = (props) => {
if (curworkflow !== undefined) {
useworkflow = curworkflow
} else {
alert.info("Saving workflow")
//alert.info("Saving workflow")
}
var cyelements = cy.elements()
@@ -752,6 +758,7 @@ const AngularWorkflow = (props) => {
credentials: "include",
})
.then((response) => {
setSavingState(0)
if (response.status !== 200) {
console.log("Status not 200 for setting workflows :O!")
}
@@ -773,10 +780,15 @@ const AngularWorkflow = (props) => {
setWorkflow(workflow)
}
alert.success("Successfully saved workflow")
//alert.success("Successfully saved workflow")
setSavingState(1)
setTimeout(() => {
setSavingState(0)
}, 3000);
}
})
.catch(error => {
setSavingState(0)
alert.error(error.toString())
});
@@ -3842,7 +3854,6 @@ const AngularWorkflow = (props) => {
})
}
const headerSize = 68
const rightsidebarStyle = {
position: "fixed",
right: 0,
@@ -5159,11 +5170,42 @@ const AngularWorkflow = (props) => {
})}
</Select>
}
{/*subworkflow === undefined || subworkflow === null || subworkflow.id === undefined ? null :
<Select
value={subworkflow}
SelectDisplayProps={{
style: {
marginLeft: 10,
}
}}
fullWidth
onChange={(e) => {
setSubworkflow(e.target.value)
setUpdate(Math.random())
workflow.triggers[selectedTriggerIndex].parameters[0].value = e.target.value.id
setWorkflow(workflow)
}}
style={{backgroundColor: inputColor, color: "white", height: "50px"}}
>
{workflows.map((data, index) => {
if (data.id === workflow.id) {
return null
}
return (
<MenuItem key={index} style={{backgroundColor: inputColor, color: "white"}} value={data}>
{data.name}
</MenuItem>
)
})}
</Select>
*/}
{workflow.triggers[selectedTriggerIndex].parameters[0].value.length === 0 ? null : <span style={{marginTop: 5}}><a href={`/workflows/${workflow.triggers[selectedTriggerIndex].parameters[0].value}`} target="_blank" style={{textDecoration: "none", color: "#f85a3e"}}>Explore selected workflow</a></span>}
<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>Execution Argument: </b>
<b>Execution Argument</b>
</div>
</div>
<TextField
@@ -6160,8 +6202,8 @@ const AngularWorkflow = (props) => {
/>
</Tooltip>
<Tooltip color="primary" title="Save (ctrl+s)" placement="top">
<Button color="primary" style={{height: 50, marginLeft: 10, }} variant={lastSaved ? "outlined" : "contained"} onClick={() => saveWorkflow()}>
<SaveIcon />
<Button disabled={savingState !== 0} color="primary" style={{height: 50, width: 64, marginLeft: 10, }} variant={lastSaved ? "outlined" : "contained"} onClick={() => saveWorkflow()}>
{savingState === 2 ? <CircularProgress style={{height: 35, width: 35}} /> : savingState === 1 ? <DoneIcon style={{color: "green"}} /> : <SaveIcon /> }
</Button>
</Tooltip>
<Tooltip color="secondary" title="Fit to screen (ctrl+f)" placement="top">