Skip to content

Commit

Permalink
Add more field for display (#2233)
Browse files Browse the repository at this point in the history
Signed-off-by: Min Min <[email protected]>

Signed-off-by: Min Min <[email protected]>
  • Loading branch information
jamsman94 authored Dec 30, 2022
1 parent 1cb74ea commit bfa3d96
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 4 deletions.
24 changes: 20 additions & 4 deletions pkg/microservice/aslan/core/system/service/dashboard.go
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ func GetRunningWorkflow(log *zap.SugaredLogger) ([]*WorkflowResponse, error) {
runningCustomQueue := workflowcontroller.RunningTasks()
pendingCustomQueue := workflowcontroller.PendingTasks()
for _, runningtask := range runningQueue {
resp = append(resp, &WorkflowResponse{
arg := &WorkflowResponse{
TaskID: runningtask.TaskID,
Name: runningtask.PipelineName,
Project: runningtask.ProductName,
Expand All @@ -107,7 +107,15 @@ func GetRunningWorkflow(log *zap.SugaredLogger) ([]*WorkflowResponse, error) {
Status: string(runningtask.Status),
DisplayName: runningtask.PipelineDisplayName,
Type: string(runningtask.Type),
})
}
if runningtask.TestArgs != nil {
arg.TestName = runningtask.TestArgs.TestName
}
if runningtask.ScanningArgs != nil {
arg.ScanName = runningtask.ScanningArgs.ScanningName
arg.ScanID = runningtask.ScanningArgs.ScanningID
}
resp = append(resp, arg)
}
for _, runningtask := range runningCustomQueue {
resp = append(resp, &WorkflowResponse{
Expand All @@ -122,7 +130,7 @@ func GetRunningWorkflow(log *zap.SugaredLogger) ([]*WorkflowResponse, error) {
})
}
for _, pendingTask := range pendingQueue {
resp = append(resp, &WorkflowResponse{
arg := &WorkflowResponse{
TaskID: pendingTask.TaskID,
Name: pendingTask.PipelineName,
Project: pendingTask.ProductName,
Expand All @@ -131,7 +139,15 @@ func GetRunningWorkflow(log *zap.SugaredLogger) ([]*WorkflowResponse, error) {
Status: string(pendingTask.Status),
DisplayName: pendingTask.PipelineDisplayName,
Type: string(pendingTask.Type),
})
}
if pendingTask.TestArgs != nil {
arg.TestName = pendingTask.TestArgs.TestName
}
if pendingTask.ScanningArgs != nil {
arg.ScanName = pendingTask.ScanningArgs.ScanningName
arg.ScanID = pendingTask.ScanningArgs.ScanningID
}
resp = append(resp, arg)
}
for _, pendingTask := range pendingCustomQueue {
resp = append(resp, &WorkflowResponse{
Expand Down
3 changes: 3 additions & 0 deletions pkg/microservice/aslan/core/system/service/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,9 @@ type WorkflowResponse struct {
Status string `json:"status"`
DisplayName string `json:"display_name"`
Type string `json:"workflow_type"`
TestName string `json:"test_name,omitempty"`
ScanName string `json:"scan_name,omitempty"`
ScanID string `json:"scan_id,omitempty"`
}

type EnvResponse struct {
Expand Down

0 comments on commit bfa3d96

Please sign in to comment.