Added basic debug view
This commit is contained in:
+25
-24
@@ -18,7 +18,7 @@ import (
|
||||
"net/http"
|
||||
"os"
|
||||
"os/exec"
|
||||
"regexp"
|
||||
//"regexp"
|
||||
"strconv"
|
||||
"strings"
|
||||
"time"
|
||||
@@ -797,43 +797,44 @@ func parseLoginParameters(resp http.ResponseWriter, request *http.Request) (logi
|
||||
}
|
||||
|
||||
// Can check against HIBP etc?
|
||||
// Removed for localhost
|
||||
func checkPasswordStrength(password string) error {
|
||||
// Check password strength here
|
||||
if len(password) < 10 {
|
||||
return errors.New("Minimum password length is 10.")
|
||||
}
|
||||
//if len(password) < 10 {
|
||||
// return errors.New("Minimum password length is 10.")
|
||||
//}
|
||||
|
||||
if len(password) > 128 {
|
||||
return errors.New("Maximum password length is 128.")
|
||||
}
|
||||
//if len(password) > 128 {
|
||||
// return errors.New("Maximum password length is 128.")
|
||||
//}
|
||||
|
||||
re := regexp.MustCompile("[0-9]+")
|
||||
if len(re.FindAllString(password, -1)) == 0 {
|
||||
return errors.New("Password must contain a number")
|
||||
}
|
||||
//re := regexp.MustCompile("[0-9]+")
|
||||
//if len(re.FindAllString(password, -1)) == 0 {
|
||||
// return errors.New("Password must contain a number")
|
||||
//}
|
||||
|
||||
re = regexp.MustCompile("[a-z]+")
|
||||
if len(re.FindAllString(password, -1)) == 0 {
|
||||
return errors.New("Password must contain a lower case char")
|
||||
}
|
||||
//re = regexp.MustCompile("[a-z]+")
|
||||
//if len(re.FindAllString(password, -1)) == 0 {
|
||||
// return errors.New("Password must contain a lower case char")
|
||||
//}
|
||||
|
||||
re = regexp.MustCompile("[A-Z]+")
|
||||
if len(re.FindAllString(password, -1)) == 0 {
|
||||
return errors.New("Password must contain an upper case char")
|
||||
}
|
||||
//re = regexp.MustCompile("[A-Z]+")
|
||||
//if len(re.FindAllString(password, -1)) == 0 {
|
||||
// return errors.New("Password must contain an upper case char")
|
||||
//}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// Fuck emails
|
||||
// No more emails :)
|
||||
func checkUsername(Username string) error {
|
||||
// Stupid first check of email loool
|
||||
if !strings.Contains(Username, "@") || !strings.Contains(Username, ".") {
|
||||
return errors.New("Invalid Username")
|
||||
}
|
||||
//if !strings.Contains(Username, "@") || !strings.Contains(Username, ".") {
|
||||
// return errors.New("Invalid Username")
|
||||
//}
|
||||
|
||||
if len(Username) < 4 {
|
||||
return errors.New("Minimum Username length is 2")
|
||||
return errors.New("Minimum Username length is 4")
|
||||
}
|
||||
|
||||
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)
|
||||
if len(workflowExecution.Results) == len(workflowExecution.Workflow.Actions)+extraInputs {
|
||||
finished := true
|
||||
lastResult := ""
|
||||
for _, result := range workflowExecution.Results {
|
||||
if result.Status != "SUCCESS" && result.Status != "FINISHED" {
|
||||
finished = false
|
||||
break
|
||||
}
|
||||
|
||||
lastResult = result.Result
|
||||
}
|
||||
|
||||
if finished {
|
||||
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.")
|
||||
|
||||
workflowExecution.Result = lastResult
|
||||
workflowExecution.Status = "FINISHED"
|
||||
workflowExecution.CompletedAt = int64(time.Now().Unix())
|
||||
if workflowExecution.LastNode == "" {
|
||||
|
||||
@@ -49,7 +49,7 @@ const AdminAccount = props => {
|
||||
const [loginInfo, setLoginInfo] = useState("");
|
||||
|
||||
const handleValidateForm = () => {
|
||||
return (username.length > 1 && password.length > 8);
|
||||
return (username.length > 1 && password.length > 1);
|
||||
}
|
||||
|
||||
if (isLoggedIn === true) {
|
||||
|
||||
@@ -155,27 +155,75 @@ const AngularWorkflow = (props) => {
|
||||
const [AppsHoverColor, setAppsHoverColor] = useState(hoverOutColor);
|
||||
const [VariablesHoverColor, setVariablesHoverColor] = useState(hoverOutColor);
|
||||
const [HookHoverColor, setHookHoverColor] = useState(hoverOutColor);
|
||||
const [appAdded, setAppAdded] = useState(false)
|
||||
const [update, setUpdate] = useState("");
|
||||
const [workflowExecutions, setWorkflowExecutions] = React.useState([]);
|
||||
|
||||
const [elements, setElements] = useState([])
|
||||
const { start, stop } = useInterval({
|
||||
duration: 5000,
|
||||
startImmediate: false,
|
||||
callback: () => {
|
||||
fetchUpdates()
|
||||
fetchUpdates()
|
||||
}
|
||||
});
|
||||
|
||||
const fetchUpdates = () => {
|
||||
fetch(globalUrl+"/api/v1/streams/results", {
|
||||
method: 'POST',
|
||||
const getWorkflowExecution = (id) => {
|
||||
fetch(globalUrl+"/api/v1/workflows/"+id+"/executions", {
|
||||
method: 'GET',
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
'Accept': 'application/json',
|
||||
},
|
||||
body: JSON.stringify(executionRequest),
|
||||
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 = () => {
|
||||
fetch(globalUrl+"/api/v1/streams/results", {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
'Accept': 'application/json',
|
||||
},
|
||||
body: JSON.stringify(executionRequest),
|
||||
credentials: "include",
|
||||
})
|
||||
.then((response) => {
|
||||
if (response.status !== 200) {
|
||||
console.log("Status not 200 for stream results :O!")
|
||||
@@ -185,6 +233,7 @@ const AngularWorkflow = (props) => {
|
||||
})
|
||||
.then((responseJson) => {
|
||||
handleUpdateResults(responseJson)
|
||||
getWorkflowExecution(props.match.params.key)
|
||||
})
|
||||
.catch(error => {
|
||||
alert.error(error.toString())
|
||||
@@ -965,6 +1014,7 @@ const AngularWorkflow = (props) => {
|
||||
getWorkflow()
|
||||
getApps()
|
||||
getEnvironments()
|
||||
getWorkflowExecution(props.match.params.key)
|
||||
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 boxSize = 100
|
||||
const executionButton = executionRunning ?
|
||||
@@ -4166,6 +4231,8 @@ const AngularWorkflow = (props) => {
|
||||
<RightSideBar />
|
||||
<BottomCytoscapeBar />
|
||||
<TopCytoscapeBar />
|
||||
<NoActionsBar />
|
||||
{debugView}
|
||||
</div>
|
||||
:
|
||||
<div style={{color: "white"}}>
|
||||
|
||||
@@ -47,7 +47,7 @@ const LoginDialog = props => {
|
||||
const [loginInfo, setLoginInfo] = useState("");
|
||||
|
||||
const handleValidateForm = () => {
|
||||
return (username.length > 1 && password.length > 8);
|
||||
return (username.length > 1 && password.length > 1);
|
||||
}
|
||||
|
||||
if (isLoggedIn === true) {
|
||||
|
||||
@@ -618,6 +618,12 @@ const Workflows = (props) => {
|
||||
<div>
|
||||
Results: {resultsLength}
|
||||
</div>
|
||||
<div>
|
||||
Results: {resultsLength}
|
||||
</div>
|
||||
<div>
|
||||
Result: {selectedExecution.result}
|
||||
</div>
|
||||
<div>
|
||||
Status: {selectedExecution.status}
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user