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