Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 11 additions & 8 deletions cmd/search/versionList.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@ import (
"github.com/buildsafedev/bsf/pkg/clients/search"
)

const (
totalCols = 6
)

type versionListModel struct {
pkgList list.Model
versionTable table.Model
Expand Down Expand Up @@ -45,14 +49,13 @@ func convFPR2Rows(versions *buildsafev1.FetchPackagesResponse) []table.Row {

// initVersionTable initializes the version table
func initVersionTable(searchList list.Model, versions *buildsafev1.FetchPackagesResponse) *versionListModel {
cols := 6
columns := []table.Column{
{Title: "Name", Width: frameWidth / cols},
{Title: "Version", Width: frameWidth / cols},
{Title: "License", Width: frameWidth / cols},
{Title: "Free", Width: frameWidth / cols},
{Title: "Homepage", Width: frameWidth * 2 / cols},
{Title: "Date", Width: frameWidth / cols},
{Title: "Name", Width: frameWidth / totalCols},
{Title: "Version", Width: frameWidth / totalCols},
{Title: "License", Width: frameWidth / totalCols},
{Title: "Free", Width: frameWidth / totalCols},
{Title: "Homepage", Width: frameWidth * 2 / totalCols},
{Title: "Date", Width: frameWidth / totalCols},
}

rows := convFPR2Rows(versions)
Expand Down Expand Up @@ -112,7 +115,7 @@ func (m versionListModel) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
break
}
row := m.versionTable.SelectedRow()
if len(row) != 5 {
if len(row) != totalCols {
// TODO: return errMsg
return m, tea.Quit
}
Expand Down