[#1223] lens/tui: Add alternative text on open an empty bucket

Add an alternative text to display in the selected bucket's records
view in case that bucket is empty.

Signed-off-by: Aleksey Savchuk <a.savchuk@yadro.com>
This commit is contained in:
Aleksey Savchuk 2024-08-12 16:18:44 +03:00
parent 4ed3b273f9
commit f8ce4ea63a
No known key found for this signature in database

View file

@ -138,6 +138,16 @@ func (v *RecordsView) Draw(screen tcell.Screen) {
// }
v.DrawForSubclass(screen, v)
// No records in that bucket.
if v.firstRecordIndex == v.lastRecordIndex {
tview.Print(
screen, "Empty Bucket", x, y+1, width,
tview.AlignCenter, tview.Styles.PrimaryTextColor,
)
return
}
for index := v.firstRecordIndex; index < v.lastRecordIndex; index++ {
result := v.records[index].Entry
text := result.String()