table

package
v1.5.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 6, 2022 License: Apache-2.0 Imports: 23 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetDistributionStatus

func GetDistributionStatus(str string) string

func IsNodeLabelInBlacklist added in v1.4.0

func IsNodeLabelInBlacklist(node data.Object) bool

func IsNodeOffline added in v1.4.0

func IsNodeOffline(node data.Object) bool

func SortByDistribution

func SortByDistribution(data []RowItem, sortColumn string, ascend bool)

SortByDistribution sort by percent

func SortByDistributionRate added in v1.5.0

func SortByDistributionRate(data []RowItem, sortColumn string, ascend bool)

SortByDistributionRate sort by percent

func SortByNode

func SortByNode(data []RowItem, _ string, ascend bool)

SortByNode sort by node struct

func SortByRole added in v1.5.0

func SortByRole(data []RowItem, _ string, ascend bool)

SortByRole sort by node struct

func SortByStatus

func SortByStatus(data []RowItem, _ string, asc bool)

SortByStatus sort by percent

func SortByString

func SortByString(data []RowItem, sortColumn string, ascend bool)

SortByString sort by string value

Types

type BatchOperation

type BatchOperation struct {
	Key       string   `json:"key,omitempty"`
	Text      string   `json:"text,omitempty"`
	Reload    bool     `json:"reload,omitempty"`
	ShowIndex []string `json:"showIndex,omitempty"`
}

type Columns

type Columns struct {
	Title     string `json:"title,omitempty"`
	DataIndex string `json:"dataIndex,omitempty"`
	Width     int    `json:"width,omitempty"`
	Sortable  bool   `json:"sorter,omitempty"`
	Fixed     string `json:"fixed,omitempty"`
	TitleTip  string `json:"titleTip"`
	Hidden    bool   `json:"hidden"`
	Align     string `json:"align"`
}

type Command

type Command struct {
	Key     string       `json:"key,omitempty"`
	Command CommandState `json:"state,omitempty"`
	Target  string       `json:"target,omitempty"`
	JumpOut bool         `json:"jumpOut,omitempty"`
}

type CommandState

type CommandState struct {
	Params   Params                 `json:"params,omitempty"`
	Visible  bool                   `json:"visible,omitempty"`
	FormData FormData               `json:"formData,omitempty"`
	Query    map[string]interface{} `json:"query,omitempty"`
}

type Distribution

type Distribution struct {
	RenderType string `json:"renderType,omitempty"`
	//Value      DistributionValue `json:"value,omitempty"`
	Value  string `json:"value"`
	Status string `json:"status,omitempty"`
	Tip    string `json:"tip,omitempty"`
}

type DistributionRate added in v1.5.0

type DistributionRate struct {
	RenderType        string  `json:"renderType,omitempty"`
	Value             string  `json:"value"`
	DistributionValue float64 `json:"distributionValue"`
}

type DistributionValue

type DistributionValue struct {
	Text    string `json:"text"`
	Percent string `json:"percent"`
}

type FormData

type FormData struct {
	RecordId string `json:"recordId,omitempty"`
}

type GetRowItem

type GetRowItem interface {
	GetRowItems(c []data.Object, requests map[string]cmp.AllocatedRes) ([]RowItem, error)
}

type GetTable added in v1.5.0

type GetTable interface {
	GetRowItem
	GetTableProps
}

type GetTableProps added in v1.5.0

type GetTableProps interface {
	GetProps() map[string]interface{}
}

type Labels

type Labels struct {
	RenderType string               `json:"renderType,omitempty"`
	Value      []label.Label        `json:"value,omitempty"`
	Operations map[string]Operation `json:"operations,omitempty"`
}

type LabelsValue

type LabelsValue struct {
	Label string `json:"label"`
	Group string `json:"group"`
}

type Meta

type Meta struct {
	Id       int    `json:"id,omitempty"`
	PageSize int    `json:"pageSize,omitempty"`
	PageNo   int    `json:"pageNo,omitempty"`
	Sorter   Sorter `json:"sorter,omitempty"`
}

type Node

type Node struct {
	RenderType string        `json:"renderType,omitempty"`
	Direction  string        `json:"direction"`
	Renders    []interface{} `json:"renders,omitempty"`
}

type NodeIcon added in v1.5.0

type NodeIcon struct {
	RenderType string `json:"renderType,omitempty"`
	Icon       string `json:"icon,omitempty"`
}
type NodeLink struct {
	RenderType string               `json:"renderType,omitempty"`
	Value      string               `json:"value,omitempty"`
	Operations map[string]Operation `json:"operations,omitempty"`
	Reload     bool                 `json:"reload"`
}

type NodeTags

type NodeTags struct {
	RenderType string               `json:"renderType,omitempty"`
	Value      []label.Label        `json:"value,omitempty"`
	Operation  map[string]Operation `json:"operation,omitempty"`
}

type Operate

type Operate struct {
	RenderType string               `json:"renderType,omitempty"`
	Operations map[string]Operation `json:"operations,omitempty"`
}

type Operation

type Operation struct {
	Key           string      `json:"key,omitempty"`
	Reload        bool        `json:"reload"`
	FillMeta      string      `json:"fillMeta,omitempty"`
	Confirm       string      `json:"confirm"`
	Target        string      `json:"target,omitempty"`
	Meta          interface{} `json:"meta,omitempty"`
	ClickableKeys interface{} `json:"clickableKeys,omitempty"`
	Text          string      `json:"text,omitempty"`
	Command       *Command    `json:"command,omitempty"`
}

type Params

type Params struct {
	NodeId string `json:"nodeId,omitempty"`
	NodeIP string `json:"nodeIP,omitempty"`
}

type Role added in v1.5.0

type Role struct {
	RenderType string    `json:"renderType"`
	Value      RoleValue `json:"value"`
	Size       string    `json:"size"`
}

type RoleValue added in v1.5.0

type RoleValue struct {
	Label string `json:"label"`
}

type RowItem

type RowItem struct {
	ID      string      `json:"id,omitempty"`
	IP      string      `json:"IP,omitempty"`
	Status  SteveStatus `json:"Status,omitempty"`
	Node    Node        `json:"Node,omitempty"`
	NodeID  string      `json:"nodeId,omitempty"`
	Role    Role        `json:"Role,omitempty"`
	Version string      `json:"Version,omitempty"`
	//
	Distribution     Distribution     `json:"Distribution,omitempty"`
	Usage            Distribution     `json:"Usage,omitempty"`
	DistributionRate DistributionRate `json:"DistributionRate,omitempty"`
	Operate          Operate          `json:"Operate,omitempty"`
	// batchOperations for json
	BatchOperations []string `json:"batchOperations,omitempty"`
}

type Scroll

type Scroll struct {
	X int `json:"x,omitempty"`
	Y int `json:"y,omitempty"`
}

type Sorter

type Sorter struct {
	Field string `json:"field,omitempty"`
	Order string `json:"order,omitempty"`
}

type State

type State struct {
	//PageNo          int           `json:"pageNo,omitempty"`
	//PageSize        int           `json:"pageSize,omitempty"`
	//Left           int           `json:"total,omitempty"`
	SelectedRowKeys []string      `json:"selectedRowKeys,omitempty"`
	Sorter          Sorter        `json:"sorterData,omitempty"`
	Values          filter.Values `json:"values,omitempty"`
	FilterUrlQuery  string        `json:"table__urlQuery,omitempty"`
}

type SteveStatus

type SteveStatus struct {
	Value      string `json:"value,omitempty"`
	RenderType string `json:"renderType"`
	Status     string `json:"status"`
}

type Table

type Table struct {
	CpuTable GetTable
	MemTable GetTable
	PodTable GetTable
	base.DefaultProvider
	SDK        *cptype.SDK
	Ctx        context.Context
	Metrics    metrics.Interface
	Server     cmp.SteveServer
	Type       string                 `json:"type"`
	Props      map[string]interface{} `json:"props"`
	Operations map[string]interface{} `json:"operations"`
	State      State                  `json:"state"`
}

func (*Table) CordonNode

func (t *Table) CordonNode(ctx context.Context, nodeNames []string) error

func (*Table) DecodeURLQuery added in v1.5.0

func (t *Table) DecodeURLQuery() error

func (*Table) EncodeURLQuery added in v1.5.0

func (t *Table) EncodeURLQuery() error

func (*Table) GetDistributionRate added in v1.5.0

func (t *Table) GetDistributionRate(allocate, request float64, resourceType TableType) DistributionRate

func (*Table) GetDistributionValue

func (t *Table) GetDistributionValue(req, total float64, resourceType TableType) DistributionValue

func (*Table) GetIp

func (t *Table) GetIp(node data.Object) string

func (*Table) GetItemStatus

func (t *Table) GetItemStatus(node data.Object) (*SteveStatus, error)

func (*Table) GetLabelGroupAndDisplayName

func (t *Table) GetLabelGroupAndDisplayName(label string) (string, string)

func (*Table) GetLabelOperation

func (t *Table) GetLabelOperation(rowId string) map[string]Operation

func (*Table) GetMetrics added in v1.4.0

func (t *Table) GetMetrics(ctx context.Context)

func (*Table) GetNodeAddress

func (t *Table) GetNodeAddress(addrs []v1.NodeAddress) string

func (*Table) GetNodeLabels

func (t *Table) GetNodeLabels(labels data.Object) []label.Label

func (*Table) GetNodes

func (t *Table) GetNodes(ctx context.Context, gs *cptype.GlobalStateData) ([]data.Object, error)

func (*Table) GetOperate

func (t *Table) GetOperate(id string) Operate

func (*Table) GetPods

func (t *Table) GetPods(ctx context.Context) (map[string][]data.Object, error)

func (*Table) GetRenders

func (t *Table) GetRenders(id string, labelMap data.Object) []interface{}

func (*Table) GetScaleValue

func (t *Table) GetScaleValue(a, b float64, Type TableType) string

func (*Table) GetTableOperation

func (t *Table) GetTableOperation() map[string]interface{}

func (*Table) GetUsageValue

func (t *Table) GetUsageValue(used, total float64, resourceType TableType) DistributionValue

func (*Table) RenderList

func (t *Table) RenderList(component *cptype.Component, tableType TableType, gs *cptype.GlobalStateData) error

func (*Table) SetComponentValue

func (t *Table) SetComponentValue(c *cptype.Component) error

SetComponentValue mapping properties to Component

func (*Table) SetData

func (t *Table) SetData(nodes []data.Object, tableType TableType, requests map[string]cmp.AllocatedRes) ([]RowItem, error)

SetData assemble rowItem of table

func (*Table) UncordonNode

func (t *Table) UncordonNode(ctx context.Context, nodeNames []string) error

type TableType

type TableType string
const (
	DefaultPageSize = 10
	DefaultPageNo   = 1

	Pod    TableType = "pod"
	Memory TableType = "memory"
	Cpu    TableType = "cpu"
)
const (
	CPU_TAB TableType = "cpu-analysis"

	MEM_TAB TableType = "mem-analysis"

	POD_TAB TableType = "pod-analysis"
)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL