1
0
mirror of https://github.com/rancher/steve.git synced 2025-08-08 09:47:17 +00:00
steve/pkg/resources/common/defaultcolumns.go

38 lines
689 B
Go
Raw Normal View History

2019-08-14 18:08:34 +00:00
package common
import (
"github.com/rancher/naok/pkg/attributes"
"github.com/rancher/naok/pkg/table"
"github.com/rancher/norman/pkg/types"
)
2019-09-09 21:28:55 +00: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 18:08:34 +00: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 21:28:55 +00:00
NameColumn,
CreatedColumn,
2019-08-14 18:08:34 +00:00
})
}
return nil
}