Add names so the analysis UI renders

This commit is contained in:
Marc Campbell
2019-11-08 00:22:57 +00:00
parent b926ff6fa2
commit 8a1e129dbe
3 changed files with 8 additions and 4 deletions

View File

@@ -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 {

View File

@@ -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))
}

View File

@@ -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))
}