Skip to content

Commit

Permalink
feat: support reload in logs
Browse files Browse the repository at this point in the history
  • Loading branch information
keidarcy committed Jan 14, 2024
1 parent 8c57a7e commit b78f801
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 7 deletions.
2 changes: 2 additions & 0 deletions ui/json.go
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@ func (v *View) switchToLogsList() {
if err != nil {
return
}
v.secondaryKind = LogsPage
v.showListPages(selected, "logs")
}

Expand Down Expand Up @@ -169,6 +170,7 @@ func (v *View) handleFullScreenContentInput(event *tcell.EventKey) *tcell.EventK
}

func (v *View) handleTableContentDone(key tcell.Key) {
v.secondaryKind = v.kind
pageName := v.kind.getTablePageName(v.getClusterArn())
v.tablePages.SwitchToPage(pageName)
}
Expand Down
3 changes: 3 additions & 0 deletions ui/kind.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ const (
TaskDefinitionPage
TaskDefinitionRevisionsPage
ServiceEventsPage
LogsPage
)

func (k Kind) String() string {
Expand All @@ -31,6 +32,8 @@ func (k Kind) String() string {
return "taskDefinitionRevisions"
case ServiceEventsPage:
return "serviceEvents"
case LogsPage:
return "logs"
default:
return "unknownKind"
}
Expand Down
20 changes: 13 additions & 7 deletions ui/view.go
Original file line number Diff line number Diff line change
Expand Up @@ -84,13 +84,14 @@ type InfoItem struct {

// Base struct of different views
type View struct {
app *App
table *tview.Table
infoPages *tview.Pages
tablePages *tview.Pages
kind Kind
keys []KeyInput
footer *Footer
app *App
table *tview.Table
infoPages *tview.Pages
tablePages *tview.Pages
kind Kind
secondaryKind Kind
keys []KeyInput
footer *Footer
}

func newView(app *App, kind Kind, keys []KeyInput) *View {
Expand Down Expand Up @@ -199,6 +200,11 @@ func (v *View) reloadResource() error {
}

func (v *View) showKindPage(k Kind) error {
switch v.secondaryKind {
case LogsPage:
v.switchToLogsList()
return nil
}
switch k {
case ClusterPage:
return v.app.showClustersPage()
Expand Down

0 comments on commit b78f801

Please sign in to comment.