From 459cc1bf560b4d739c12b4f7581608d880d777b2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Omar=20Vergara=20P=C3=A9rez?= Date: Mon, 11 Nov 2024 22:13:27 -0600 Subject: [PATCH] fix: fix broken ux (#244) * fix(tui): fix pagination * fix(tui): fix table list interaction by returning the previous behavior before the port to tview --- pkg/tui/tui.go | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/pkg/tui/tui.go b/pkg/tui/tui.go index b69920c..ffc71e9 100644 --- a/pkg/tui/tui.go +++ b/pkg/tui/tui.go @@ -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. @@ -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() { @@ -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.