@ -512,7 +512,7 @@ func (m model) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
|
|||||||
m.table = msg.table
|
m.table = msg.table
|
||||||
|
|
||||||
m.table = m.table.WithTargetWidth(m.width)
|
m.table = m.table.WithTargetWidth(m.width)
|
||||||
m.table = m.table.WithPageSize(m.height - 10)
|
m.table = m.table.WithPageSize(calculateHeight(m))
|
||||||
|
|
||||||
if m.initStatusGather {
|
if m.initStatusGather {
|
||||||
m.pollingStatus = true
|
m.pollingStatus = true
|
||||||
@ -526,7 +526,7 @@ func (m model) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
|
|||||||
m.height = msg.Height
|
m.height = msg.Height
|
||||||
|
|
||||||
m.table = m.table.WithTargetWidth(m.width)
|
m.table = m.table.WithTargetWidth(m.width)
|
||||||
m.table = m.table.WithPageSize(m.height - 10)
|
m.table = m.table.WithPageSize(calculateHeight(m))
|
||||||
case errorMsg:
|
case errorMsg:
|
||||||
m.err = msg
|
m.err = msg
|
||||||
}
|
}
|
||||||
@ -540,6 +540,10 @@ func (m model) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
|
|||||||
return m, tea.Batch(cmds...)
|
return m, tea.Batch(cmds...)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func calculateHeight(m model) int {
|
||||||
|
return m.height/2 - 5
|
||||||
|
}
|
||||||
|
|
||||||
func (m model) View() string {
|
func (m model) View() string {
|
||||||
if m.err != nil {
|
if m.err != nil {
|
||||||
return fmt.Sprintf("FATA: %v", m.err)
|
return fmt.Sprintf("FATA: %v", m.err)
|
||||||
@ -554,7 +558,7 @@ func (m model) View() string {
|
|||||||
m.numFilteredServers, m.numFilteredApps, m.numFilteredRecipes,
|
m.numFilteredServers, m.numFilteredApps, m.numFilteredRecipes,
|
||||||
)
|
)
|
||||||
|
|
||||||
help := "[q] quit • [/] filter • [s] status"
|
help := "[q] quit • [/] filter • [s] status • [ctrl+u/d] page up/down"
|
||||||
|
|
||||||
body.WriteString(lipgloss.JoinHorizontal(lipgloss.Center, stats, " | ", help))
|
body.WriteString(lipgloss.JoinHorizontal(lipgloss.Center, stats, " | ", help))
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user