generated from LinuxSuRen/.github
/
resource.go
57 lines (48 loc) · 1.08 KB
/
resource.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
package ui
import (
"github.com/gdamore/tcell/v2"
"github.com/kubesphere-sigs/ks/kubectl-plugin/pipeline/ui/actions"
"github.com/rivo/tview"
)
// Resource represents a resource view
type Resource interface {
tview.Primitive
GetKeyActions() actions.KeyActions
AddKeyActions(actions.KeyActions)
SetKind(string)
GetKind() string
}
// ResourcePrimitive represents a grid view
type ResourcePrimitive struct {
*tview.Grid
}
// GetKeyActions returns the key actions
func (r *ResourcePrimitive) GetKeyActions() actions.KeyActions {
return map[tcell.Key]actions.KeyAction{
'r': {
Description: "Run goto PipelineRun",
},
'R': {
Description: "Run Pipeline",
},
'v': {
Description: "List the PipelineRuns",
},
'c': {
Description: "Create a Pipeline",
},
'y': {
Description: "View the as YAML",
},
}
}
// AddKeyActions add key actions
func (r *ResourcePrimitive) AddKeyActions(actions.KeyActions) {
}
// SetKind set the kind
func (r *ResourcePrimitive) SetKind(string) {
}
// GetKind returns the kind
func (r *ResourcePrimitive) GetKind() string {
return ""
}