Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 14 additions & 7 deletions stats/printStats.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ func (rw *GenericResultsWriter) PrintJson() error {
msg = "JPDs: No JPD Available"
case *ReleaseBundleResponse:
msg = "Release Bundles: No Release Bundle Info Available"
case jpd.GenericError:
case *jpd.GenericError:
msg = fmt.Sprintf("Errors: %s", v.Error())
}
jsonBytes, err = json.MarshalIndent(msg, "", " ")
Expand Down Expand Up @@ -86,7 +86,7 @@ func (rw *GenericResultsWriter) PrintDashboard() error {
PrintJPDsDashboard(*v, rw.displayLimit)
case *ReleaseBundleResponse:
PrintReleaseBundlesDashboard(v, rw.displayLimit)
case jpd.GenericError:
case *jpd.GenericError:
PrintErrorsDashboard(v)
}
return nil
Expand Down Expand Up @@ -143,6 +143,9 @@ func PrintProjectsDashboard(projects []services.Project, displayLimit int) {
project := (projects)[i]
tableData = append(tableData, TableRow{Metric: text.FgHiBlue.Sprint(project.ProjectKey), Value: text.FgGreen.Sprint(project.DisplayName)})
}
if len(tableData) == 1 {
tableData = []TableRow{}
}

footer := ""
if actualProjectsCount > displayLimit {
Expand Down Expand Up @@ -177,6 +180,9 @@ func PrintJPDsDashboard(jpdList []JPD, displayLimit int) {
Value: status,
})
}
if len(tableData) == 1 {
tableData = []TableRow{}
}

footer := ""
if actualCount > displayLimit {
Expand All @@ -198,15 +204,17 @@ func PrintReleaseBundlesDashboard(rbResponse *ReleaseBundleResponse, displayLimi
}
actualCount := len(rbResponse.ReleaseBundles)

tableData := []TableRow{{"Name", "Project Key"}} // Headers
tableData := []TableRow{{"Name", "Release Bundle"}}
for i := 0; i < loopRange; i++ {
rb := rbResponse.ReleaseBundles[i]
tableData = append(tableData, TableRow{
Metric: text.FgGreen.Sprint(rb.ReleaseBundleName),
Value: text.FgWhite.Sprint(rb.ProjectKey),
})
}

if len(tableData) == 1 {
tableData = []TableRow{}
}
footer := ""
if actualCount > displayLimit {
footer = text.FgYellow.Sprintf("\n...and %d more release bundles. Refer JSON output format for complete list.", actualCount-displayLimit)
Expand All @@ -220,8 +228,8 @@ func PrintReleaseBundlesDashboard(rbResponse *ReleaseBundleResponse, displayLimi
log.Output()
}

func PrintErrorsDashboard(genericError jpd.GenericError) {
errRows := createErrorRows(genericError)
func PrintErrorsDashboard(genericError *jpd.GenericError) {
errRows := createErrorRows(*genericError)

err := coreutils.PrintTableWithBorderless(errRows, text.FgCyan.Sprint(genericError.Product), "", genericError.Error(), false)
if err != nil {
Expand All @@ -233,7 +241,6 @@ func PrintErrorsDashboard(genericError jpd.GenericError) {

func createErrorRows(genericError jpd.GenericError) []TableRow {
errorRows := []TableRow{
{Metric: text.FgCyan.Sprint("Product"), Value: text.FgRed.Sprint(genericError.Product)},
{Metric: text.FgCyan.Sprint("Error"), Value: text.FgRed.Sprint(genericError.Error())},
}
return errorRows
Expand Down
Loading