common

package
v1.4.0 Latest Latest
Warning

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

Go to latest
Published: Nov 16, 2021 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Default = "Default"

	NodeStatusReady int = iota
	NodeStatusError
	NodeStatusFreeze
)

Variables

View Source
var (
	ResourceNormal  UsageStatusEnum = "normal"
	ResourceSuccess UsageStatusEnum = "Success"
	ResourceError   UsageStatusEnum = "error"
	ResourceWarning UsageStatusEnum = "warning"
	ResourceDanger  UsageStatusEnum = "danger"

	Asc  OrderEnum = "ascend"
	Desc OrderEnum = "descend"

	ResourcesTypes = []apistructs.K8SResType{apistructs.K8SDeployment, apistructs.K8SStatefulSet, apistructs.K8SDaemonSet}

	ColorMap = map[string]string{
		"green":         "#6CB38B",
		"purple":        "#975FA0",
		"orange":        "#F7A76B",
		"red":           "#DE5757",
		"brown":         "#A98C72",
		"steelblue":     "#4E6097",
		"yellow":        "#F7C36B",
		"lightgreen":    "#8DB36C",
		"darkcyan":      "#498E9E",
		"darksalmon":    "#DE6F57",
		"darkslategray": "#2F4F4F",
		"maroon":        "#800000",
		"darkseagreen":  "#8FBC8F",
		"darkslateblue": "#483D8B",
		"darkgoldenrod": "#B8860B",
		"teal":          "#008080",
		"primary":       "#6a549e",
	}

	// cmp bashboard table
	CMPDashboardChangePageNoOperationKey   cptype.OperationKey = "changePageNo"
	CMPDashboardChangePageSizeOperationKey cptype.OperationKey = "changePageSize"
	CMPDashboardSortByColumnOperationKey   cptype.OperationKey = "changeSort"

	// cmp bashboard clusterFilter
	CMPDashboardFilterOperationKey cptype.OperationKey = "filter"

	// Freeze Button
	CMPDashboardDeleteNode   cptype.OperationKey = "delete"
	CMPDashboardUnfreezeNode cptype.OperationKey = "unfreeze"
	CMPDashboardFreezeNode   cptype.OperationKey = "freeze"
)
View Source
var (
	PodNotFoundErr            = errors.New("pod not found")
	OperationsEmptyErr        = errors.New("operation is empty")
	ResourceEmptyErr          = errors.New("node resource is empty")
	ProtocolComponentEmptyErr = errors.New("component is nil or property empty")
	BundleEmptyErr            = errors.New("bundle is empty")
	NothingToBeDoneErr        = errors.New("nothing to be done")

	TypeNotAvailableErr = errors.New("type not available")
	ResourceNotFoundErr = errors.New("resource type not available")

	//util error
	PtrRequiredErr = errors.New("ptr is required")
)

Functions

func ConvertToMap

func ConvertToMap(obj interface{}) (map[string]interface{}, error)

ConvertToMap transfer any struct to map

func GetInt64Len

func GetInt64Len(a int64) int

func GetPercent

func GetPercent(a, b float64) float64

func GetPodStatus

func GetPodStatus() string

func ResetNumberBase

func ResetNumberBase(a, b float64) (float64, float64)
ResetNumberBase

* e.g. : 20 100 to 2 10 , 0.1 1000 to 1 10000

func SortByDistribution

func SortByDistribution(data []interface{}, sortColumn string, order bool)

SortByDistribution sort by percent

func SortByName

func SortByName(data []interface{}, sortColumn string, order bool)

SortByNode sort by node struct

func SortByString

func SortByString(data []interface{}, sortColumn string, order bool)

SortByString sort by string value

func Transfer

func Transfer(a, b interface{}) error

Transfer transfer a to b with json, kind of b must be pointer

Types

type ChartDataItem

type ChartDataItem struct {
	Value float64 `json:"value"`
	Time  int64   `json:"time"`
}

type OrderEnum

type OrderEnum string

type SteveStatusEnum

type SteveStatusEnum string

type UsageStatusEnum

type UsageStatusEnum string

type WorkflowEnum

type WorkflowEnum string

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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