mirror of
https://github.com/replicatedhq/troubleshoot.git
synced 2026-04-15 07:16:34 +00:00
Add names so the analysis UI renders
This commit is contained in:
@@ -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 {
|
||||
|
||||
@@ -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))
|
||||
}
|
||||
|
||||
@@ -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))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user