Tweak system reporter output for nil values and new aliases
This commit is contained in:
parent
e240013386
commit
f759141e5a
@ -6,6 +6,7 @@ import (
|
||||
|
||||
"github.com/cortezaproject/corteza-server/pkg/dal"
|
||||
"github.com/cortezaproject/corteza-server/pkg/filter"
|
||||
"github.com/modern-go/reflect2"
|
||||
)
|
||||
|
||||
type (
|
||||
@ -92,6 +93,11 @@ func (b *reportFrameBuilder) done() *Frame {
|
||||
}
|
||||
|
||||
func (b *reportFrameBuilder) stringifyVal(col string, val any) string {
|
||||
// Edgecase for when values are nil since the stringer uses <nil> for those
|
||||
if reflect2.IsNil(val) {
|
||||
return ""
|
||||
}
|
||||
|
||||
// @todo nicer formatting and such? V1 didn't do much different
|
||||
return fmt.Sprintf("%v", val)
|
||||
}
|
||||
|
||||
@ -4,6 +4,7 @@ import (
|
||||
"context"
|
||||
"fmt"
|
||||
"strconv"
|
||||
"strings"
|
||||
|
||||
"github.com/cortezaproject/corteza-server/pkg/dal"
|
||||
"github.com/cortezaproject/corteza-server/pkg/errors"
|
||||
@ -395,7 +396,8 @@ func (svc *report) enhance(ctx context.Context, ff []*reporting.Frame) (err erro
|
||||
for i, c := range f.Columns {
|
||||
// Translate system columns
|
||||
if c.System {
|
||||
c.Label = svc.locale.T(ctx, "compose", fmt.Sprintf("field.system.%s", c.Name))
|
||||
pp := strings.Split(c.Name, ".")
|
||||
c.Label = svc.locale.T(ctx, "compose", fmt.Sprintf("field.system.%s", pp[len(pp)-1]))
|
||||
f.Columns[i] = c
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user