Default column labels to their names

This commit is contained in:
Tomaž Jerman
2021-08-16 09:16:07 +02:00
parent 7626714050
commit 9b07ed3af9
3 changed files with 13 additions and 0 deletions
+3
View File
@@ -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)
}
+2
View File
@@ -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
+8
View File
@@ -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