Added workflow priority search and orborus checkin IP
This commit is contained in:
@@ -3846,7 +3846,7 @@ func runInitEs(ctx context.Context) {
|
||||
//}
|
||||
|
||||
} else {
|
||||
log.Printf("[DEBUG] There are %d org(s).", len(activeOrgs))
|
||||
log.Printf("[DEBUG] Found %d org(s) in total.", len(activeOrgs))
|
||||
|
||||
if len(activeOrgs) == 1 {
|
||||
if len(activeOrgs[0].Users) == 0 {
|
||||
|
||||
@@ -569,7 +569,7 @@ func handleGetWorkflowqueueConfirm(resp http.ResponseWriter, request *http.Reque
|
||||
// FIXME: Add authentication?
|
||||
id := request.Header.Get("Org-Id")
|
||||
if len(id) == 0 {
|
||||
log.Printf("No Org-Id header set - confirm")
|
||||
log.Printf("[ERROR] No Org-Id header set - confirm")
|
||||
resp.WriteHeader(401)
|
||||
resp.Write([]byte(fmt.Sprintf(`{"success": false, "reason": "Specify the org-id header."}`)))
|
||||
return
|
||||
@@ -579,7 +579,7 @@ func handleGetWorkflowqueueConfirm(resp http.ResponseWriter, request *http.Reque
|
||||
ctx := context.Background()
|
||||
executionRequests, err := shuffle.GetWorkflowQueue(ctx, id)
|
||||
if err != nil {
|
||||
log.Printf("(1) Failed reading body for workflowqueue: %s", err)
|
||||
log.Printf("[WARNING] (1) Failed reading body for workflowqueue: %s", err)
|
||||
resp.WriteHeader(401)
|
||||
resp.Write([]byte(fmt.Sprintf(`{"success": false, "reason": "Entity parsing error - confirm"}`)))
|
||||
return
|
||||
@@ -685,11 +685,65 @@ func handleGetWorkflowqueue(resp http.ResponseWriter, request *http.Request) {
|
||||
return
|
||||
}
|
||||
|
||||
env, err := shuffle.GetEnvironment(ctx, id, "")
|
||||
timeNow := time.Now().Unix()
|
||||
if err == nil && len(env.Id) > 0 && len(env.Name) > 0 {
|
||||
if time.Now().Unix() > env.Edited+60 {
|
||||
log.Printf("[DEBUG] Updating env with IP %s!", request.RemoteAddr)
|
||||
env.RunningIp = request.RemoteAddr
|
||||
env.Checkin = timeNow
|
||||
err = shuffle.SetEnvironment(ctx, env)
|
||||
if err != nil {
|
||||
log.Printf("[WARNING] Failed updating environment: %s", err)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Checking and updating the environment related to the first execution
|
||||
if len(executionRequests.Data) == 0 {
|
||||
executionRequests.Data = []shuffle.ExecutionRequest{}
|
||||
} else {
|
||||
//log.Printf("[INFO] Executionrequests (%s): %d", id, len(executionRequests.Data))
|
||||
//log.Printf("IDS: %#v", executionRequests.Data[0].ExecutionId)
|
||||
log.Printf("In workflowqueue with %d", len(executionRequests.Data))
|
||||
|
||||
// Try again :)
|
||||
if len(env.Id) == 0 && len(env.Name) == 0 {
|
||||
orgId := ""
|
||||
for _, requestData := range executionRequests.Data {
|
||||
execution, err := shuffle.GetWorkflowExecution(ctx, requestData.ExecutionId)
|
||||
if err == nil {
|
||||
if len(execution.ExecutionOrg) > 0 {
|
||||
orgId = execution.ExecutionOrg
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if len(orgId) > 0 {
|
||||
env, err := shuffle.GetEnvironment(ctx, id, orgId)
|
||||
if err != nil {
|
||||
log.Printf("[WARNING] No env found matching %s - continuing without updating orborus anyway: %s", id, err)
|
||||
//resp.WriteHeader(401)
|
||||
//resp.Write([]byte(fmt.Sprintf(`{"success": false, "reason": "No env found matching %s"}`, id)))
|
||||
//return
|
||||
} else {
|
||||
log.Printf("Found Env: %#v", env)
|
||||
if timeNow > env.Edited+60 {
|
||||
log.Printf("Updating env with IP %s!", request.RemoteAddr)
|
||||
env.RunningIp = request.RemoteAddr
|
||||
env.Checkin = timeNow
|
||||
err = shuffle.SetEnvironment(ctx, env)
|
||||
if err != nil {
|
||||
log.Printf("[WARNING] Failed updating environment: %s", err)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if len(executionRequests.Data) > 10 {
|
||||
executionRequests.Data = executionRequests.Data[0:9]
|
||||
}
|
||||
log.Printf("In workflowqueue with %d (2)", len(executionRequests.Data))
|
||||
}
|
||||
|
||||
newjson, err := json.Marshal(executionRequests)
|
||||
|
||||
@@ -2717,7 +2717,7 @@ const Admin = (props) => {
|
||||
style={{minWidth: 150, maxWidth: 150}}
|
||||
/>
|
||||
<ListItemText
|
||||
primary="Orborus running (TBD)"
|
||||
primary="Orborus running"
|
||||
style={{minWidth: 200, maxWidth: 200}}
|
||||
/>
|
||||
<ListItemText
|
||||
@@ -2736,6 +2736,10 @@ const Admin = (props) => {
|
||||
primary="Archived"
|
||||
style={{minWidth: 150, maxWidth: 150}}
|
||||
/>
|
||||
<ListItemText
|
||||
primary="Last Changed"
|
||||
style={{minWidth: 150, maxWidth: 150}}
|
||||
/>
|
||||
</ListItem>
|
||||
{environments === undefined || environments === null ? null : environments.map((environment, index)=> {
|
||||
if (!showArchived && environment.archived) {
|
||||
@@ -2747,19 +2751,19 @@ const Admin = (props) => {
|
||||
return null
|
||||
}
|
||||
|
||||
//var bgColor = "#27292d"
|
||||
//if (index % 2 === 0) {
|
||||
// bgColor = "#1f2023"
|
||||
//}
|
||||
var bgColor = "#27292d"
|
||||
if (index % 2 === 0) {
|
||||
bgColor = "#1f2023"
|
||||
}
|
||||
|
||||
return (
|
||||
<ListItem key={index}>
|
||||
<ListItem key={index} style={{backgroundColor: bgColor}}>
|
||||
<ListItemText
|
||||
primary={environment.Name}
|
||||
style={{minWidth: 150, maxWidth: 150, overflow: "hidden"}}
|
||||
/>
|
||||
<ListItemText
|
||||
primary={environment.Type === "cloud" ? "N/A" : "TBD"}
|
||||
primary={environment.Type !== "cloud" ? environment.running_ip === undefined || environment.running_ip === null || environment.running_ip.length === 0 ? "Not started" : environment.running_ip : "N/A"}
|
||||
style={{minWidth: 200, maxWidth: 200, overflow: "hidden"}}
|
||||
/>
|
||||
<ListItemText
|
||||
@@ -2786,6 +2790,10 @@ const Admin = (props) => {
|
||||
style={{minWidth: 150, maxWidth: 150, overflow: "hidden"}}
|
||||
primary={environment.archived.toString()}
|
||||
/>
|
||||
<ListItemText
|
||||
style={{minWidth: 150, maxWidth: 150, overflow: "hidden"}}
|
||||
primary={environment.edited !== undefined && environment.edited !== null && environment.edited !== 0 ? new Date(environment.edited*1000).toISOString() : 0}
|
||||
/>
|
||||
</ListItem>
|
||||
)
|
||||
})}
|
||||
@@ -2907,7 +2915,7 @@ const Admin = (props) => {
|
||||
style={{minWidth: 150, maxWidth: 150}}
|
||||
/>
|
||||
<ListItemText
|
||||
primary="Orborus running (TBD)"
|
||||
primary="Orborus running"
|
||||
style={{minWidth: 200, maxWidth: 200}}
|
||||
/>
|
||||
<ListItemText
|
||||
|
||||
@@ -8145,6 +8145,7 @@ const AngularWorkflow = (props) => {
|
||||
<Button
|
||||
style={{borderRadius: "0px"}}
|
||||
variant="outlined"
|
||||
fullWidth
|
||||
onClick={() => {
|
||||
getWorkflowExecution(props.match.params.key, "")
|
||||
}} color="primary">
|
||||
|
||||
@@ -444,7 +444,7 @@ const Workflows = (props) => {
|
||||
return
|
||||
}
|
||||
|
||||
if (filters.includes(data)) {
|
||||
if (filters.includes(data) || filters.includes(data.toLowerCase())) {
|
||||
return
|
||||
}
|
||||
|
||||
@@ -2061,7 +2061,7 @@ const Workflows = (props) => {
|
||||
<div style={flexContainerStyle}>
|
||||
<div style={{...flexBoxStyle, ...activeWorkflowStyle}}>
|
||||
<div style={flexContentStyle}>
|
||||
<div ><img src={mobileImage} style={iconStyle} /></div>
|
||||
<div><img src={mobileImage} style={iconStyle} /></div>
|
||||
<div style={ blockRightStyle }>
|
||||
<div style={counterStyle}>{workflows.length}</div>
|
||||
<div style={fontSize_16}>ACTIVE WORKFLOWS</div>
|
||||
@@ -2155,7 +2155,9 @@ const Workflows = (props) => {
|
||||
}}>
|
||||
<Tooltip title={`Filter by ${data.app_name}`} placement="top">
|
||||
<Badge badgeContent={0} color="secondary" style={{fontSize: 10}}>
|
||||
<img style={{height: imgSize, width: imgSize, cursor: "pointer", borderRadius: imgSize/2, border: "2px solid rgba(255,255,255,0.7)"}} alt={data.app_name} src={data.large_image}/>
|
||||
<div style={{height: imgSize, width: imgSize, position: "relative", filter: "brightness(0.6)", backgroundColor: "#000", borderRadius: imgSize/2, zIndex: 100, overflow: "hidden", display: "flex", justifyContent: "center", }}>
|
||||
<img style={{height: imgSize, width: imgSize, position: "absolute", top: -2, left: -2, cursor: "pointer", zIndex: 99, border: "2px solid rgba(255,255,255,0.7)", }} alt={data.app_name} src={data.large_image}/>
|
||||
</div>
|
||||
</Badge>
|
||||
</Tooltip>
|
||||
</IconButton>
|
||||
|
||||
Reference in New Issue
Block a user