table

package
v1.3.0-rc Latest Latest
Warning

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

Go to latest
Published: Sep 10, 2021 License: Apache-2.0 Imports: 18 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetDistributionStatus

func GetDistributionStatus(str string) string

func SortByDistribution

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

SortByDistribution sort by percent

func SortByNode

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

SortByNode 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, asc 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"`
}

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 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 {
	GetRowItem(c data.Object, resName TableType) (*RowItem, error)
}

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"`
	Renders    []interface{} `json:"renders,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"`
	Target        string      `json:"target,omitempty"`
	Meta          interface{} `json:"meta,omitempty"`
	ClickableKeys interface{} `json:"clickableKeys,omitempty"`
	Text          string      `json:"text,omitempty"`
	Command       Command     `json:"command"`
}

type Params

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

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"`
	Role    string      `json:"Role,omitempty"`
	Version string      `json:"Version,omitempty"`
	//
	Distribution Distribution `json:"Distribution,omitempty"`
	Usage        Distribution `json:"Usage,omitempty"`
	UsageRate    Distribution `json:"UsageRate,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"`
	Total           int           `json:"total,omitempty"`
	SelectedRowKeys []string      `json:"selectedRowKeys,omitempty"`
	Sorter          Sorter        `json:"sorterData,omitempty"`
	Values          filter.Values `json:"values"`
}

type SteveStatus

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

type Table

type Table struct {
	TableComponent GetRowItem
	base.DefaultProvider
	CtxBdl     *bundle.Bundle
	SDK        *cptype.SDK
	Ctx        context.Context
	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(nodeNames []string) error

func (*Table) GetDistributionRate added in v1.5.0

func (t *Table) GetDistributionRate(metricsData apistructs.MetricsData, resourceType TableType) DistributionValue

func (*Table) GetDistributionValue

func (t *Table) GetDistributionValue(metricsData apistructs.MetricsData, 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) 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(gs *cptype.GlobalStateData) ([]data.Object, error)

func (*Table) GetOperate

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

func (*Table) GetRenders

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

func (*Table) GetScaleValue

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

func (*Table) GetTableOperation

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

func (*Table) GetUsageValue

func (t *Table) GetUsageValue(metricsData apistructs.MetricsData, resourceType TableType) DistributionValue

func (*Table) RenderList

func (t *Table) RenderList(component *cptype.Component, tableType TableType, nodes []data.Object) error

func (*Table) SetComponentValue

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

SetComponentValue mapping CpuInfoTable properties to Component

func (*Table) SetData

func (t *Table) SetData(nodes []data.Object, tableType TableType) ([]RowItem, error)

SetData assemble rowItem of table

func (*Table) UncordonNode

func (t *Table) UncordonNode(nodeNames []string) error

type TableType

type TableType string
const (
	DefaultPageSize = 10
	DefaultPageNo   = 1

	Pod    TableType = "pod"
	Memory TableType = "memory"
	Cpu    TableType = "cpu"
)

Jump to

Keyboard shortcuts

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