Skip to content

Commit

Permalink
fix: fix broken ux (#244)
Browse files Browse the repository at this point in the history
* fix(tui): fix pagination

* fix(tui): fix table list interaction by returning the previous behavior before the port to tview
  • Loading branch information
danvergara authored Nov 12, 2024
1 parent da247d6 commit 459cc1b
Showing 1 changed file with 5 additions and 9 deletions.
14 changes: 5 additions & 9 deletions pkg/tui/tui.go
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,8 @@ func (t *Tui) setupQueries() {
return event
}

t.aw.pagination.SetText(fmt.Sprintf("%4d / %4d", 1, 1))

query := t.aw.queries.GetText()

// Call the Query method from the client and populate the content page.
Expand Down Expand Up @@ -290,6 +292,8 @@ func (t *Tui) setupTablesList() error {
switch event.Key() {
case tcell.KeyCtrlL:
t.app.SetFocus(t.aw.queries)
case tcell.KeyEnter:
t.updateTableMetadataOnChange("")
}

switch event.Rune() {
Expand All @@ -306,19 +310,11 @@ func (t *Tui) setupTablesList() error {
return event
})

t.aw.tables.SetFocusFunc(func() {
t.updateTableMetadataOnChange("")
})

t.aw.tables.SetChangedFunc(func(i int, tableName string, st string, s rune) {
t.updateTableMetadataOnChange(tableName)
})

return nil
}

func (t *Tui) setupPagination() {
t.aw.pagination = tview.NewTextView().SetText("1 / 10")
t.aw.pagination = tview.NewTextView().SetText(fmt.Sprintf("%4d / %4d", 1, 1))
}

// updateTableMetadataOnChange functions updates tables' data related views on different events.
Expand Down

0 comments on commit 459cc1b

Please sign in to comment.