1
0
mirror of https://github.com/rancher/steve.git synced 2025-09-07 02:10:30 +00:00
Files
steve/pkg/resources/common/defaultcolumns.go

38 lines
691 B
Go
Raw Normal View History

2019-08-14 11:08:34 -07:00
package common
import (
2019-09-11 14:05:00 -07:00
"github.com/rancher/steve/pkg/attributes"
"github.com/rancher/steve/pkg/table"
2019-08-14 11:08:34 -07:00
"github.com/rancher/norman/pkg/types"
)
2019-09-09 14:28:55 -07:00
var (
NameColumn = table.Column{
Name: "Name",
Field: "metadata.name",
Type: "string",
Format: "name",
}
CreatedColumn = table.Column{
Name: "Created",
Field: "metadata.creationTimestamp",
Type: "string",
Format: "date",
}
)
2019-08-14 11:08:34 -07:00
type DefaultColumns struct {
types.EmptyMapper
}
func (d *DefaultColumns) ModifySchema(schema *types.Schema, schemas *types.Schemas) error {
if attributes.Columns(schema) == nil {
attributes.SetColumns(schema, []table.Column{
2019-09-09 14:28:55 -07:00
NameColumn,
CreatedColumn,
2019-08-14 11:08:34 -07:00
})
}
return nil
}