mirror of
https://github.com/niusmallnan/steve.git
synced 2025-07-17 08:01:14 +00:00
Add format to columns
This commit is contained in:
parent
583309b969
commit
f2c0706220
@ -14,14 +14,16 @@ func (d *DefaultColumns) ModifySchema(schema *types.Schema, schemas *types.Schem
|
|||||||
if attributes.Columns(schema) == nil {
|
if attributes.Columns(schema) == nil {
|
||||||
attributes.SetColumns(schema, []table.Column{
|
attributes.SetColumns(schema, []table.Column{
|
||||||
{
|
{
|
||||||
Name: "Name",
|
Name: "Name",
|
||||||
Field: "metadata.name",
|
Field: "metadata.name",
|
||||||
Type: "string",
|
Type: "string",
|
||||||
|
Format: "name",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
Name: "Created",
|
Name: "Created",
|
||||||
Field: "metadata.creationTimestamp",
|
Field: "metadata.creationTimestamp",
|
||||||
Type: "date",
|
Type: "string",
|
||||||
|
Format: "date",
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
@ -47,9 +47,10 @@ func forVersion(group, version, resource string, schemas map[string]*types.Schem
|
|||||||
var versionColumns []table.Column
|
var versionColumns []table.Column
|
||||||
for _, col := range columnDefs {
|
for _, col := range columnDefs {
|
||||||
versionColumns = append(versionColumns, table.Column{
|
versionColumns = append(versionColumns, table.Column{
|
||||||
Name: col.Name,
|
Name: col.Name,
|
||||||
Field: col.JSONPath,
|
Field: col.JSONPath,
|
||||||
Type: col.Type,
|
Type: col.Type,
|
||||||
|
Format: col.Format,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
if len(versionColumns) == 0 {
|
if len(versionColumns) == 0 {
|
||||||
|
@ -7,9 +7,10 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
type Column struct {
|
type Column struct {
|
||||||
Name string `json:"name,omitempty"`
|
Name string `json:"name,omitempty"`
|
||||||
Field string `json:"field,omitempty"`
|
Field string `json:"field,omitempty"`
|
||||||
Type string `json:"type,omitempty"`
|
Type string `json:"type,omitempty"`
|
||||||
|
Format string `json:"format,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type Table struct {
|
type Table struct {
|
||||||
|
Loading…
Reference in New Issue
Block a user