Default column labels to their names
This commit is contained in:
@@ -82,6 +82,9 @@ func (svc record) Datasource(ctx context.Context, ld *report.LoadStepDefinition)
|
||||
c = report.MakeColumnOfKind(k)
|
||||
c.Name = f.Name
|
||||
c.Label = f.Label
|
||||
if c.Label == "" {
|
||||
c.Label = c.Name
|
||||
}
|
||||
cols = append(cols, c)
|
||||
}
|
||||
|
||||
|
||||
@@ -32,6 +32,8 @@ type (
|
||||
GroupColumn struct {
|
||||
// Name defines the alias for the new column
|
||||
Name string `json:"name"`
|
||||
// Label defines the user friendly name for the column
|
||||
Label string `json:"label"`
|
||||
// Expr defines the expression to transform the column
|
||||
Expr string `json:"expr"`
|
||||
// Aggregate defines the aggregation function to apply
|
||||
|
||||
@@ -123,6 +123,10 @@ func (r *recordDatasource) Group(d report.GroupDefinition, name string) (bool, e
|
||||
// @todo imply based on context
|
||||
c := report.MakeColumnOfKind(g.Kind)
|
||||
c.Name = g.Name
|
||||
c.Label = g.Label
|
||||
if c.Label == "" {
|
||||
c.Label = c.Name
|
||||
}
|
||||
gCols = append(gCols, c)
|
||||
|
||||
r.levelColumns[g.Name] = true
|
||||
@@ -153,6 +157,10 @@ func (r *recordDatasource) Group(d report.GroupDefinition, name string) (bool, e
|
||||
col = report.MakeColumnOfKind("Number")
|
||||
}
|
||||
col.Name = c.Name
|
||||
col.Label = c.Label
|
||||
if col.Label == "" {
|
||||
col.Label = col.Name
|
||||
}
|
||||
gCols = append(gCols, col)
|
||||
r.levelColumns[c.Name] = true
|
||||
|
||||
|
||||
Reference in New Issue
Block a user