From f2c07062204bb2677c5ad93e8ab27c8547da396b Mon Sep 17 00:00:00 2001 From: Darren Shepherd Date: Wed, 14 Aug 2019 11:16:37 -0700 Subject: [PATCH] Add format to columns --- pkg/resources/common/defaultcolumns.go | 14 ++++++++------ pkg/resources/schema/converter/crd.go | 7 ++++--- pkg/table/mapper.go | 7 ++++--- 3 files changed, 16 insertions(+), 12 deletions(-) diff --git a/pkg/resources/common/defaultcolumns.go b/pkg/resources/common/defaultcolumns.go index 17fb825..40393e7 100644 --- a/pkg/resources/common/defaultcolumns.go +++ b/pkg/resources/common/defaultcolumns.go @@ -14,14 +14,16 @@ func (d *DefaultColumns) ModifySchema(schema *types.Schema, schemas *types.Schem if attributes.Columns(schema) == nil { attributes.SetColumns(schema, []table.Column{ { - Name: "Name", - Field: "metadata.name", - Type: "string", + Name: "Name", + Field: "metadata.name", + Type: "string", + Format: "name", }, { - Name: "Created", - Field: "metadata.creationTimestamp", - Type: "date", + Name: "Created", + Field: "metadata.creationTimestamp", + Type: "string", + Format: "date", }, }) } diff --git a/pkg/resources/schema/converter/crd.go b/pkg/resources/schema/converter/crd.go index b27a982..bbec861 100644 --- a/pkg/resources/schema/converter/crd.go +++ b/pkg/resources/schema/converter/crd.go @@ -47,9 +47,10 @@ func forVersion(group, version, resource string, schemas map[string]*types.Schem var versionColumns []table.Column for _, col := range columnDefs { versionColumns = append(versionColumns, table.Column{ - Name: col.Name, - Field: col.JSONPath, - Type: col.Type, + Name: col.Name, + Field: col.JSONPath, + Type: col.Type, + Format: col.Format, }) } if len(versionColumns) == 0 { diff --git a/pkg/table/mapper.go b/pkg/table/mapper.go index 69a3123..ec929bc 100644 --- a/pkg/table/mapper.go +++ b/pkg/table/mapper.go @@ -7,9 +7,10 @@ import ( ) type Column struct { - Name string `json:"name,omitempty"` - Field string `json:"field,omitempty"` - Type string `json:"type,omitempty"` + Name string `json:"name,omitempty"` + Field string `json:"field,omitempty"` + Type string `json:"type,omitempty"` + Format string `json:"format,omitempty"` } type Table struct {