@@ -6,26 +6,9 @@ import (
66 "github.com/charmbracelet/lipgloss"
77
88 wfclient "github.com/render-oss/cli/pkg/client/workflows"
9- "github.com/render-oss/cli/pkg/pointers"
109 "github.com/render-oss/cli/pkg/style"
1110)
1211
13- type ListItem struct {
14- taskRun * wfclient.TaskRun
15- }
16-
17- func (i ListItem ) TaskRun () * wfclient.TaskRun {
18- return i .taskRun
19- }
20-
21- func NewListItem (tr * wfclient.TaskRun ) ListItem {
22- return ListItem {taskRun : tr }
23- }
24-
25- func (i ListItem ) Title () string {
26- return style .Title .Render (i .taskRun .Id )
27- }
28-
2912func statusWithStyle (status wfclient.TaskRunStatus ) lipgloss.Style {
3013 switch status {
3114 case wfclient .Failed :
@@ -36,36 +19,6 @@ func statusWithStyle(status wfclient.TaskRunStatus) lipgloss.Style {
3619 return style .Status .Foreground (style .ColorOK )
3720}
3821
39- func (i ListItem ) Description () string {
40- statusLine := statusWithStyle (i .taskRun .Status ).Render (string (i .taskRun .Status ))
41-
42- var timeInfo string
43- if i .taskRun .StartedAt != nil {
44- if i .taskRun .CompletedAt != nil {
45- duration := i .taskRun .CompletedAt .Sub (* i .taskRun .StartedAt )
46- timeInfo = lipgloss .JoinHorizontal (lipgloss .Left ,
47- style .FormatKeyValue ("Started" , pointers .TimeValue (i .taskRun .StartedAt )),
48- " " ,
49- style .FormatKeyValue ("Duration" , duration .String ()),
50- )
51- } else {
52- timeInfo = style .FormatKeyValue ("Started" , pointers .TimeValue (i .taskRun .StartedAt ))
53- }
54- } else {
55- timeInfo = style .FormatKeyValue ("Status" , "Not started" )
56- }
57-
58- return lipgloss .JoinVertical (lipgloss .Left , statusLine , timeInfo )
59- }
60-
61- func (i ListItem ) FilterValue () string {
62- return i .taskRun .Id
63- }
64-
65- func (i ListItem ) Height () int {
66- return 5
67- }
68-
6922func Header () []string {
7023 return []string {"ID" , "Status" , "Started" , "Completed" , "Duration" }
7124}
@@ -79,14 +32,7 @@ func Row(taskRun *wfclient.TaskRun) []string {
7932 if taskRun .CompletedAt != nil {
8033 completed = taskRun .CompletedAt .Format (time .RFC3339 )
8134 duration = taskRun .CompletedAt .Sub (* taskRun .StartedAt ).String ()
82- } else {
83- completed = ""
84- duration = ""
8535 }
86- } else {
87- started = ""
88- completed = ""
89- duration = ""
9036 }
9137
9238 return []string {
0 commit comments