Skip to content

Commit

Permalink
Add names so the analysis UI renders
Browse files Browse the repository at this point in the history
  • Loading branch information
marccampbell committed Nov 8, 2019
1 parent b926ff6 commit 8a1e129
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 4 deletions.
6 changes: 4 additions & 2 deletions pkg/analyze/common_status.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,10 @@ import (
troubleshootv1beta1 "github.com/replicatedhq/troubleshoot/pkg/apis/troubleshoot/v1beta1"
)

func commonStatus(outcomes []*troubleshootv1beta1.Outcome, readyReplicas int) (*AnalyzeResult, error) {
result := &AnalyzeResult{}
func commonStatus(outcomes []*troubleshootv1beta1.Outcome, title string, readyReplicas int) (*AnalyzeResult, error) {
result := &AnalyzeResult{
Title: title,
}

// ordering from the spec is important, the first one that matches returns
for _, outcome := range outcomes {
Expand Down
3 changes: 2 additions & 1 deletion pkg/analyze/deployment_status.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,11 @@ func deploymentStatus(analyzer *troubleshootv1beta1.DeploymentStatus, getCollect
if status == nil {
// there's not an error, but maybe the requested deployment is not even deployed
return &AnalyzeResult{
Title: fmt.Sprintf("%s Deployment Status", analyzer.Name),
IsFail: true,
Message: "not found",
}, nil
}

return commonStatus(analyzer.Outcomes, int(status.ReadyReplicas))
return commonStatus(analyzer.Outcomes, fmt.Sprintf("%s Status", analyzer.Name), int(status.ReadyReplicas))
}
3 changes: 2 additions & 1 deletion pkg/analyze/statefulset_status.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,11 @@ func statefulsetStatus(analyzer *troubleshootv1beta1.StatefulsetStatus, getColle
if status == nil {
// there's not an error, but maybe the requested statefulset is not even deployed
return &AnalyzeResult{
Title: fmt.Sprintf("%s Statefulset Status", analyzer.Name),
IsFail: true,
Message: "not found",
}, nil
}

return commonStatus(analyzer.Outcomes, int(status.ReadyReplicas))
return commonStatus(analyzer.Outcomes, fmt.Sprintf("%s Status", analyzer.Name), int(status.ReadyReplicas))
}

0 comments on commit 8a1e129

Please sign in to comment.