Added basic debug view
This commit is contained in:
+25
-24
@@ -18,7 +18,7 @@ import (
|
|||||||
"net/http"
|
"net/http"
|
||||||
"os"
|
"os"
|
||||||
"os/exec"
|
"os/exec"
|
||||||
"regexp"
|
//"regexp"
|
||||||
"strconv"
|
"strconv"
|
||||||
"strings"
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
@@ -797,43 +797,44 @@ func parseLoginParameters(resp http.ResponseWriter, request *http.Request) (logi
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Can check against HIBP etc?
|
// Can check against HIBP etc?
|
||||||
|
// Removed for localhost
|
||||||
func checkPasswordStrength(password string) error {
|
func checkPasswordStrength(password string) error {
|
||||||
// Check password strength here
|
// Check password strength here
|
||||||
if len(password) < 10 {
|
//if len(password) < 10 {
|
||||||
return errors.New("Minimum password length is 10.")
|
// return errors.New("Minimum password length is 10.")
|
||||||
}
|
//}
|
||||||
|
|
||||||
if len(password) > 128 {
|
//if len(password) > 128 {
|
||||||
return errors.New("Maximum password length is 128.")
|
// return errors.New("Maximum password length is 128.")
|
||||||
}
|
//}
|
||||||
|
|
||||||
re := regexp.MustCompile("[0-9]+")
|
//re := regexp.MustCompile("[0-9]+")
|
||||||
if len(re.FindAllString(password, -1)) == 0 {
|
//if len(re.FindAllString(password, -1)) == 0 {
|
||||||
return errors.New("Password must contain a number")
|
// return errors.New("Password must contain a number")
|
||||||
}
|
//}
|
||||||
|
|
||||||
re = regexp.MustCompile("[a-z]+")
|
//re = regexp.MustCompile("[a-z]+")
|
||||||
if len(re.FindAllString(password, -1)) == 0 {
|
//if len(re.FindAllString(password, -1)) == 0 {
|
||||||
return errors.New("Password must contain a lower case char")
|
// return errors.New("Password must contain a lower case char")
|
||||||
}
|
//}
|
||||||
|
|
||||||
re = regexp.MustCompile("[A-Z]+")
|
//re = regexp.MustCompile("[A-Z]+")
|
||||||
if len(re.FindAllString(password, -1)) == 0 {
|
//if len(re.FindAllString(password, -1)) == 0 {
|
||||||
return errors.New("Password must contain an upper case char")
|
// return errors.New("Password must contain an upper case char")
|
||||||
}
|
//}
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// Fuck emails
|
// No more emails :)
|
||||||
func checkUsername(Username string) error {
|
func checkUsername(Username string) error {
|
||||||
// Stupid first check of email loool
|
// Stupid first check of email loool
|
||||||
if !strings.Contains(Username, "@") || !strings.Contains(Username, ".") {
|
//if !strings.Contains(Username, "@") || !strings.Contains(Username, ".") {
|
||||||
return errors.New("Invalid Username")
|
// return errors.New("Invalid Username")
|
||||||
}
|
//}
|
||||||
|
|
||||||
if len(Username) < 4 {
|
if len(Username) < 4 {
|
||||||
return errors.New("Minimum Username length is 2")
|
return errors.New("Minimum Username length is 4")
|
||||||
}
|
}
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
|
|||||||
@@ -777,16 +777,21 @@ func handleWorkflowQueue(resp http.ResponseWriter, request *http.Request) {
|
|||||||
//log.Printf("Checking results %d vs %d", len(workflowExecution.Results), len(workflowExecution.Workflow.Actions)+extraInputs)
|
//log.Printf("Checking results %d vs %d", len(workflowExecution.Results), len(workflowExecution.Workflow.Actions)+extraInputs)
|
||||||
if len(workflowExecution.Results) == len(workflowExecution.Workflow.Actions)+extraInputs {
|
if len(workflowExecution.Results) == len(workflowExecution.Workflow.Actions)+extraInputs {
|
||||||
finished := true
|
finished := true
|
||||||
|
lastResult := ""
|
||||||
for _, result := range workflowExecution.Results {
|
for _, result := range workflowExecution.Results {
|
||||||
if result.Status != "SUCCESS" && result.Status != "FINISHED" {
|
if result.Status != "SUCCESS" && result.Status != "FINISHED" {
|
||||||
finished = false
|
finished = false
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
|
|
||||||
|
lastResult = result.Result
|
||||||
}
|
}
|
||||||
|
|
||||||
if finished {
|
if finished {
|
||||||
log.Printf("Execution of %s finished.", workflowExecution.ExecutionId)
|
log.Printf("Execution of %s finished.", workflowExecution.ExecutionId)
|
||||||
//log.Println("Might be finished based on length of results and everything being SUCCESS or FINISHED - VERIFY THIS. Setting status to finished.")
|
//log.Println("Might be finished based on length of results and everything being SUCCESS or FINISHED - VERIFY THIS. Setting status to finished.")
|
||||||
|
|
||||||
|
workflowExecution.Result = lastResult
|
||||||
workflowExecution.Status = "FINISHED"
|
workflowExecution.Status = "FINISHED"
|
||||||
workflowExecution.CompletedAt = int64(time.Now().Unix())
|
workflowExecution.CompletedAt = int64(time.Now().Unix())
|
||||||
if workflowExecution.LastNode == "" {
|
if workflowExecution.LastNode == "" {
|
||||||
|
|||||||
@@ -49,7 +49,7 @@ const AdminAccount = props => {
|
|||||||
const [loginInfo, setLoginInfo] = useState("");
|
const [loginInfo, setLoginInfo] = useState("");
|
||||||
|
|
||||||
const handleValidateForm = () => {
|
const handleValidateForm = () => {
|
||||||
return (username.length > 1 && password.length > 8);
|
return (username.length > 1 && password.length > 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isLoggedIn === true) {
|
if (isLoggedIn === true) {
|
||||||
|
|||||||
@@ -155,7 +155,9 @@ const AngularWorkflow = (props) => {
|
|||||||
const [AppsHoverColor, setAppsHoverColor] = useState(hoverOutColor);
|
const [AppsHoverColor, setAppsHoverColor] = useState(hoverOutColor);
|
||||||
const [VariablesHoverColor, setVariablesHoverColor] = useState(hoverOutColor);
|
const [VariablesHoverColor, setVariablesHoverColor] = useState(hoverOutColor);
|
||||||
const [HookHoverColor, setHookHoverColor] = useState(hoverOutColor);
|
const [HookHoverColor, setHookHoverColor] = useState(hoverOutColor);
|
||||||
|
const [appAdded, setAppAdded] = useState(false)
|
||||||
const [update, setUpdate] = useState("");
|
const [update, setUpdate] = useState("");
|
||||||
|
const [workflowExecutions, setWorkflowExecutions] = React.useState([]);
|
||||||
|
|
||||||
const [elements, setElements] = useState([])
|
const [elements, setElements] = useState([])
|
||||||
const { start, stop } = useInterval({
|
const { start, stop } = useInterval({
|
||||||
@@ -166,6 +168,52 @@ const AngularWorkflow = (props) => {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const getWorkflowExecution = (id) => {
|
||||||
|
fetch(globalUrl+"/api/v1/workflows/"+id+"/executions", {
|
||||||
|
method: 'GET',
|
||||||
|
headers: {
|
||||||
|
'Content-Type': 'application/json',
|
||||||
|
'Accept': 'application/json',
|
||||||
|
},
|
||||||
|
credentials: "include",
|
||||||
|
})
|
||||||
|
.then((response) => {
|
||||||
|
if (response.status !== 200) {
|
||||||
|
console.log("Status not 200 for WORKFLOW EXECUTION :O!")
|
||||||
|
}
|
||||||
|
|
||||||
|
return response.json()
|
||||||
|
})
|
||||||
|
.then((responseJson) => {
|
||||||
|
if (responseJson.length > 0) {
|
||||||
|
setWorkflowExecutions(responseJson)
|
||||||
|
}
|
||||||
|
//setWorkflowExecutions(responseJson)
|
||||||
|
})
|
||||||
|
.catch(error => {
|
||||||
|
alert.error(error.toString())
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
const debugView = workflowExecutions.length > 0 ?
|
||||||
|
<Draggable>
|
||||||
|
<div style={{color: "white", position: "fixed", top: appBarSize+65, left: leftBarSize+20, zIndex: 5000, backgroundColor: "rgba(0,0,0,0.1)", minHeight: 100, padding: 15, maxHeight: 100, maxWidth: 500, overflowX: "hidden",}}>
|
||||||
|
{workflowExecutions.slice(0,25).map(data => {
|
||||||
|
console.log("DATA: ", data)
|
||||||
|
return (
|
||||||
|
<div>
|
||||||
|
{new Date(data.started_at*1000).toISOString()}
|
||||||
|
, status: {data.status}
|
||||||
|
{data.execution_argument.length > 0 ? ", "+data.execution_argument : ", "}
|
||||||
|
{data.result.length > 0 ? ", "+data.result : ", "}
|
||||||
|
</div>
|
||||||
|
)
|
||||||
|
return
|
||||||
|
})}
|
||||||
|
</div>
|
||||||
|
</Draggable>
|
||||||
|
: null
|
||||||
|
|
||||||
const fetchUpdates = () => {
|
const fetchUpdates = () => {
|
||||||
fetch(globalUrl+"/api/v1/streams/results", {
|
fetch(globalUrl+"/api/v1/streams/results", {
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
@@ -185,6 +233,7 @@ const AngularWorkflow = (props) => {
|
|||||||
})
|
})
|
||||||
.then((responseJson) => {
|
.then((responseJson) => {
|
||||||
handleUpdateResults(responseJson)
|
handleUpdateResults(responseJson)
|
||||||
|
getWorkflowExecution(props.match.params.key)
|
||||||
})
|
})
|
||||||
.catch(error => {
|
.catch(error => {
|
||||||
alert.error(error.toString())
|
alert.error(error.toString())
|
||||||
@@ -965,6 +1014,7 @@ const AngularWorkflow = (props) => {
|
|||||||
getWorkflow()
|
getWorkflow()
|
||||||
getApps()
|
getApps()
|
||||||
getEnvironments()
|
getEnvironments()
|
||||||
|
getWorkflowExecution(props.match.params.key)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -4006,6 +4056,21 @@ const AngularWorkflow = (props) => {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const NoActionsBar = () => {
|
||||||
|
if (workflow.actions.length === 0 || !appAdded) {
|
||||||
|
return (
|
||||||
|
<div style={{position: "fixed", width: "100%", top: 300}}>
|
||||||
|
<div style={{width: 300, margin: "auto"}}>
|
||||||
|
<h3></h3>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
return null
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
const BottomCytoscapeBar = () => {
|
const BottomCytoscapeBar = () => {
|
||||||
const boxSize = 100
|
const boxSize = 100
|
||||||
const executionButton = executionRunning ?
|
const executionButton = executionRunning ?
|
||||||
@@ -4166,6 +4231,8 @@ const AngularWorkflow = (props) => {
|
|||||||
<RightSideBar />
|
<RightSideBar />
|
||||||
<BottomCytoscapeBar />
|
<BottomCytoscapeBar />
|
||||||
<TopCytoscapeBar />
|
<TopCytoscapeBar />
|
||||||
|
<NoActionsBar />
|
||||||
|
{debugView}
|
||||||
</div>
|
</div>
|
||||||
:
|
:
|
||||||
<div style={{color: "white"}}>
|
<div style={{color: "white"}}>
|
||||||
|
|||||||
@@ -47,7 +47,7 @@ const LoginDialog = props => {
|
|||||||
const [loginInfo, setLoginInfo] = useState("");
|
const [loginInfo, setLoginInfo] = useState("");
|
||||||
|
|
||||||
const handleValidateForm = () => {
|
const handleValidateForm = () => {
|
||||||
return (username.length > 1 && password.length > 8);
|
return (username.length > 1 && password.length > 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isLoggedIn === true) {
|
if (isLoggedIn === true) {
|
||||||
|
|||||||
@@ -618,6 +618,12 @@ const Workflows = (props) => {
|
|||||||
<div>
|
<div>
|
||||||
Results: {resultsLength}
|
Results: {resultsLength}
|
||||||
</div>
|
</div>
|
||||||
|
<div>
|
||||||
|
Results: {resultsLength}
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
Result: {selectedExecution.result}
|
||||||
|
</div>
|
||||||
<div>
|
<div>
|
||||||
Status: {selectedExecution.status}
|
Status: {selectedExecution.status}
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
Reference in New Issue
Block a user