diff --git a/compose/service/record_datasource.go b/compose/service/record_datasource.go index 4997d003b..52ae2d301 100644 --- a/compose/service/record_datasource.go +++ b/compose/service/record_datasource.go @@ -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) } diff --git a/pkg/report/step_group.go b/pkg/report/step_group.go index 6ef232d42..282baf12b 100644 --- a/pkg/report/step_group.go +++ b/pkg/report/step_group.go @@ -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 diff --git a/store/rdbms/compose_record_datasource.go b/store/rdbms/compose_record_datasource.go index eb16414a0..212e96c95 100644 --- a/store/rdbms/compose_record_datasource.go +++ b/store/rdbms/compose_record_datasource.go @@ -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