Skip to content

Commit 4bfcdeb

Browse files
Updating print message (jfrog#274)
1 parent 900cfba commit 4bfcdeb

File tree

1 file changed

+14
-7
lines changed

1 file changed

+14
-7
lines changed

stats/printStats.go

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ func (rw *GenericResultsWriter) PrintJson() error {
5858
msg = "JPDs: No JPD Available"
5959
case *ReleaseBundleResponse:
6060
msg = "Release Bundles: No Release Bundle Info Available"
61-
case jpd.GenericError:
61+
case *jpd.GenericError:
6262
msg = fmt.Sprintf("Errors: %s", v.Error())
6363
}
6464
jsonBytes, err = json.MarshalIndent(msg, "", " ")
@@ -86,7 +86,7 @@ func (rw *GenericResultsWriter) PrintDashboard() error {
8686
PrintJPDsDashboard(*v, rw.displayLimit)
8787
case *ReleaseBundleResponse:
8888
PrintReleaseBundlesDashboard(v, rw.displayLimit)
89-
case jpd.GenericError:
89+
case *jpd.GenericError:
9090
PrintErrorsDashboard(v)
9191
}
9292
return nil
@@ -143,6 +143,9 @@ func PrintProjectsDashboard(projects []services.Project, displayLimit int) {
143143
project := (projects)[i]
144144
tableData = append(tableData, TableRow{Metric: text.FgHiBlue.Sprint(project.ProjectKey), Value: text.FgGreen.Sprint(project.DisplayName)})
145145
}
146+
if len(tableData) == 1 {
147+
tableData = []TableRow{}
148+
}
146149

147150
footer := ""
148151
if actualProjectsCount > displayLimit {
@@ -177,6 +180,9 @@ func PrintJPDsDashboard(jpdList []JPD, displayLimit int) {
177180
Value: status,
178181
})
179182
}
183+
if len(tableData) == 1 {
184+
tableData = []TableRow{}
185+
}
180186

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

201-
tableData := []TableRow{{"Name", "Project Key"}} // Headers
207+
tableData := []TableRow{{"Name", "Release Bundle"}}
202208
for i := 0; i < loopRange; i++ {
203209
rb := rbResponse.ReleaseBundles[i]
204210
tableData = append(tableData, TableRow{
205211
Metric: text.FgGreen.Sprint(rb.ReleaseBundleName),
206212
Value: text.FgWhite.Sprint(rb.ProjectKey),
207213
})
208214
}
209-
215+
if len(tableData) == 1 {
216+
tableData = []TableRow{}
217+
}
210218
footer := ""
211219
if actualCount > displayLimit {
212220
footer = text.FgYellow.Sprintf("\n...and %d more release bundles. Refer JSON output format for complete list.", actualCount-displayLimit)
@@ -220,8 +228,8 @@ func PrintReleaseBundlesDashboard(rbResponse *ReleaseBundleResponse, displayLimi
220228
log.Output()
221229
}
222230

223-
func PrintErrorsDashboard(genericError jpd.GenericError) {
224-
errRows := createErrorRows(genericError)
231+
func PrintErrorsDashboard(genericError *jpd.GenericError) {
232+
errRows := createErrorRows(*genericError)
225233

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

234242
func createErrorRows(genericError jpd.GenericError) []TableRow {
235243
errorRows := []TableRow{
236-
{Metric: text.FgCyan.Sprint("Product"), Value: text.FgRed.Sprint(genericError.Product)},
237244
{Metric: text.FgCyan.Sprint("Error"), Value: text.FgRed.Sprint(genericError.Error())},
238245
}
239246
return errorRows

0 commit comments

Comments
 (0)