Skip to content

Commit

Permalink
Merge pull request #8 from harakeishi/show_long_comment
Browse files Browse the repository at this point in the history
detailsの表示形式を変更
  • Loading branch information
harakeishi committed Nov 8, 2022
2 parents 662a83b + 4214906 commit 524af33
Showing 1 changed file with 2 additions and 24 deletions.
26 changes: 2 additions & 24 deletions trv/trv.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ type Trv struct {
Pages *tview.Pages
InfoLayout *tview.Grid
InfoText *tview.TextView
InfoTable *tview.Table
App *tview.Application
Layout *tview.Grid
Modal tview.Primitive
Expand Down Expand Up @@ -48,7 +47,6 @@ func (t *Trv) Init() error {
t.setSearcher()
t.setTableViewer()
t.setInfoText()
t.setInfoTable()
t.setInfoLayout()
t.setLayout()
t.setForm()
Expand Down Expand Up @@ -154,18 +152,6 @@ func (t *Trv) setInfoText() {
t.InfoText.SetText("")
}

// set Source Info Table
func (t *Trv) setInfoTable() {
t.InfoTable = tview.NewTable().
SetBorders(true).
SetCell(0, 0, tview.NewTableCell("column").SetTextColor(tcell.ColorYellow).SetAlign(tview.AlignCenter)).
SetCell(0, 1, tview.NewTableCell("type").SetTextColor(tcell.ColorYellow).SetAlign(tview.AlignCenter)).
SetCell(0, 2, tview.NewTableCell("comment").SetTextColor(tcell.ColorYellow).SetAlign(tview.AlignCenter)).
SetCell(1, 0, tview.NewTableCell("")).
SetCell(1, 1, tview.NewTableCell("")).
SetCell(1, 2, tview.NewTableCell(""))
}

// set new source form
func (t *Trv) setForm() {
var source Source
Expand Down Expand Up @@ -223,8 +209,7 @@ func (t *Trv) setInfoLayout() {
t.InfoLayout = tview.NewGrid()
t.InfoLayout.SetTitle("details").SetBorder(true)
t.InfoLayout.SetSize(5, 5, 0, 0).
AddItem(t.InfoText, 0, 0, 2, 5, 0, 0, true).
AddItem(t.InfoTable, 2, 0, 3, 5, 2, 5, true)
AddItem(t.InfoText, 0, 0, 5, 5, 0, 0, true)
t.InfoLayout.SetOffset(1, 1)
}

Expand All @@ -250,14 +235,7 @@ func (t *Trv) filterList() {
for _, v := range t.Tables {
for a, b := range v.Columns {
if v.getFullName(a) == s1 {
t.InfoText.SetText(fmt.Sprintf("table name: %s\ndetails: %s", v.Name, v.Description))
t.InfoTable.RemoveRow(1)
t.InfoTable.SetCell(1, 0, tview.NewTableCell(b.Name))
t.InfoTable.SetCell(1, 1, tview.NewTableCell(b.Type))
comment := tview.NewTableCell(b.Comment)
comment.SetMaxWidth(10)
comment.SetExpansion(10)
t.InfoTable.SetCell(1, 2, comment)
t.InfoText.SetText(fmt.Sprintf("table name: %s\ndetails: %s\n\ncolumn: %s\ntype: %s\ncomment: %s", v.Name, v.Description, b.Name, b.Type, b.Comment))
}
}
}
Expand Down

0 comments on commit 524af33

Please sign in to comment.