mirror of https://gitlab.com/gitlab-org/cli.git
Merge branch 'tui-transparency' into 'main'
fix: support transparent background on all tui views Closes #676 and #1281 See merge request https://gitlab.com/gitlab-org/cli/-/merge_requests/1416 Merged-by: Tomas Vik <tvik@gitlab.com> Approved-by: Patrick Bajao <ebajao@gitlab.com> Approved-by: Tomas Vik <tvik@gitlab.com> Co-authored-by: Louis Dutton <louis.dutton@icloud.com>
This commit is contained in:
commit
7cba522587
|
@ -186,7 +186,9 @@ func NewCmdView(f *cmdutils.Factory) *cobra.Command {
|
|||
|
||||
func drawView(opts ViewOpts) error {
|
||||
root := tview.NewPages()
|
||||
root.SetBorderPadding(1, 1, 2, 2).
|
||||
root.
|
||||
SetBackgroundColor(tcell.ColorDefault).
|
||||
SetBorderPadding(1, 1, 2, 2).
|
||||
SetBorder(true).
|
||||
SetTitle(fmt.Sprintf(" Pipeline #%d triggered %s by %s ", opts.Commit.LastPipeline.ID, utils.TimeToPrettyTimeAgo(*opts.Commit.LastPipeline.CreatedAt), opts.Commit.AuthorName))
|
||||
|
||||
|
@ -268,6 +270,7 @@ func inputCapture(
|
|||
if curJob.Kind == Job && (curJob.Status == "pending" || curJob.Status == "running") {
|
||||
modalVisible = true
|
||||
modal := tview.NewModal().
|
||||
SetBackgroundColor(tcell.ColorDefault).
|
||||
SetText(fmt.Sprintf("Are you sure you want to Cancel %s", curJob.Name)).
|
||||
AddButtons([]string{"✘ No", "✔ Yes"}).
|
||||
SetDoneFunc(func(buttonIndex int, buttonLabel string) {
|
||||
|
@ -300,6 +303,7 @@ func inputCapture(
|
|||
}
|
||||
modalVisible = true
|
||||
modal := tview.NewModal().
|
||||
SetBackgroundColor(tcell.ColorDefault).
|
||||
SetText(fmt.Sprintf("Are you sure you want to run %s", curJob.Name)).
|
||||
AddButtons([]string{"✘ No", "✔ Yes"}).
|
||||
SetDoneFunc(func(buttonIndex int, buttonLabel string) {
|
||||
|
@ -532,8 +536,11 @@ func jobsView(
|
|||
logsKey := "logs-" + curJob.Name
|
||||
if !root.SwitchToPage(logsKey).HasPage(logsKey) {
|
||||
tv := tview.NewTextView()
|
||||
tv.SetDynamicColors(true)
|
||||
tv.SetBorderPadding(0, 0, 1, 1).SetBorder(true)
|
||||
tv.
|
||||
SetDynamicColors(true).
|
||||
SetBackgroundColor(tcell.ColorDefault).
|
||||
SetBorderPadding(0, 0, 1, 1).
|
||||
SetBorder(true)
|
||||
|
||||
go func() {
|
||||
err := ciutils.RunTraceSha(
|
||||
|
@ -677,7 +684,9 @@ func box(root *tview.Pages, key string, x, y, w, h int) *tview.TextView {
|
|||
b, ok := boxes[key]
|
||||
if !ok {
|
||||
b = tview.NewTextView()
|
||||
b.SetBorder(true)
|
||||
b.
|
||||
SetBackgroundColor(tcell.ColorDefault).
|
||||
SetBorder(true)
|
||||
boxes[key] = b
|
||||
}
|
||||
b.SetRect(x, y, w, h)
|
||||
|
|
|
@ -144,8 +144,10 @@ func Test_line(t *testing.T) {
|
|||
|
||||
func testbox(x, y, w, h int) *tview.TextView {
|
||||
b := tview.NewTextView()
|
||||
b.SetBorder(true)
|
||||
b.SetRect(x, y, w, h)
|
||||
b.
|
||||
SetBackgroundColor(tcell.ColorDefault).
|
||||
SetBorder(true).
|
||||
SetRect(x, y, w, h)
|
||||
return b
|
||||
}
|
||||
|
||||
|
@ -526,7 +528,9 @@ func Test_jobsView(t *testing.T) {
|
|||
jobsCh := make(chan []*ViewJob)
|
||||
inputCh := make(chan struct{})
|
||||
root := tview.NewPages()
|
||||
root.SetBorderPadding(1, 1, 2, 2)
|
||||
root.
|
||||
SetBackgroundColor(tcell.ColorDefault).
|
||||
SetBorderPadding(1, 1, 2, 2)
|
||||
|
||||
screen := tcell.NewSimulationScreen("UTF-8")
|
||||
err := screen.Init()
|
||||
|
|
|
@ -108,6 +108,7 @@ func NewCmdView(f *cmdutils.Factory) *cobra.Command {
|
|||
}
|
||||
|
||||
root := tview.NewFlex()
|
||||
root.SetBackgroundColor(tcell.ColorDefault)
|
||||
for _, l := range boardLists {
|
||||
opts.state = ""
|
||||
var boardIssues, listTitle, listColor string
|
||||
|
@ -147,9 +148,15 @@ func NewCmdView(f *cmdutils.Factory) *cobra.Command {
|
|||
}
|
||||
|
||||
boardIssues = filterIssues(boardLists, issues, l, opts)
|
||||
bx := tview.NewTextView().SetDynamicColors(true)
|
||||
bx.SetText(boardIssues).SetWrap(true)
|
||||
bx.SetBorder(true).SetTitle(listTitle).SetTitleColor(tcell.GetColor(listColor))
|
||||
bx := tview.NewTextView()
|
||||
bx.
|
||||
SetDynamicColors(true).
|
||||
SetText(boardIssues).
|
||||
SetWrap(true).
|
||||
SetBackgroundColor(tcell.ColorDefault).
|
||||
SetBorder(true).
|
||||
SetTitle(listTitle).
|
||||
SetTitleColor(tcell.GetColor(listColor))
|
||||
root.AddItem(bx, 0, 1, false)
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue