/
base.go
75 lines (66 loc) · 1.96 KB
/
base.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
/*
* Copyright (c) 2019 Kubenext, Inc. All Rights Reserved.
* SPDX-License-Identifier: Apache-2.0
*/
package component
const (
typeAnnotations = "annotations"
typeButtonGroup = "buttonGroup"
typeCard = "card"
typeCardList = "cardList"
typeContainers = "containers"
typeError = "error"
typeExpressionSelector = "expressionSelector"
typeFlexLayout = "flexlayout"
typeGraphviz = "graphviz"
typeLabels = "labels"
typeLabelSelector = "labelSelector"
typeLink = "link"
typeList = "list"
typeLoading = "loading"
typeLogs = "logs"
typePodStatus = "podStatus"
typePort = "port"
typePorts = "ports"
typePortForward = "portforward"
typeQuadrant = "quadrant"
typeResourceViewer = "resourceViewer"
typeSelectors = "selectors"
typeSummary = "summary"
typeTable = "table"
typeText = "text"
typeTimestamp = "timestamp"
typeYAML = "yaml"
)
// base is a base component.
type base struct {
Metadata `json:"metadata"`
}
func newBase(componentType string, title []TitleComponent) base {
return base{Metadata{
Type: componentType,
Title: title,
}}
}
// GetMetadata returns the component's metadata.
func (b *base) GetMetadata() Metadata {
return b.Metadata
}
// SetAccessor sets the accessor for the object.
func (b *base) SetAccessor(accessor string) {
b.Metadata.Accessor = accessor
}
// IsEmpty returns false by default. Let the components that wrap base
// determine if they are empty or not if they wish.
func (b *base) IsEmpty() bool {
return false
}
// String returns an empty string. If a component wants to provide a value
// it can override this function.
func (b *base) String() string {
return ""
}
// LessThan returns false.
func (b *base) LessThan(i interface{}) bool {
return false
}