diff options
author | Jesse Duffield <jessedduffield@gmail.com> | 2022-01-28 20:44:36 +1100 |
---|---|---|
committer | Jesse Duffield <jessedduffield@gmail.com> | 2022-03-17 19:13:40 +1100 |
commit | a90b6efded49abcfa2516db794d7875b0396f558 (patch) | |
tree | ad9c3738830437064ada223f0978dab1d726b479 /pkg/gui/remote_branches_panel.go | |
parent | fa8571e1f4c349e401542285ea238acdbd9d17ec (diff) |
start refactoring gui
Diffstat (limited to 'pkg/gui/remote_branches_panel.go')
-rw-r--r-- | pkg/gui/remote_branches_panel.go | 30 |
1 files changed, 17 insertions, 13 deletions
diff --git a/pkg/gui/remote_branches_panel.go b/pkg/gui/remote_branches_panel.go index 29ab59187..1ee402097 100644 --- a/pkg/gui/remote_branches_panel.go +++ b/pkg/gui/remote_branches_panel.go @@ -4,6 +4,8 @@ import ( "fmt" "github.com/jesseduffield/lazygit/pkg/commands/models" + "github.com/jesseduffield/lazygit/pkg/gui/popup" + "github.com/jesseduffield/lazygit/pkg/gui/types" "github.com/jesseduffield/lazygit/pkg/utils" ) @@ -52,16 +54,18 @@ func (gui *Gui) handleDeleteRemoteBranch() error { } message := fmt.Sprintf("%s '%s'?", gui.Tr.DeleteRemoteBranchMessage, remoteBranch.FullName()) - return gui.ask(askOpts{ - title: gui.Tr.DeleteRemoteBranch, - prompt: message, - handleConfirm: func() error { - return gui.WithWaitingStatus(gui.Tr.DeletingStatus, func() error { + return gui.PopupHandler.Ask(popup.AskOpts{ + Title: gui.Tr.DeleteRemoteBranch, + Prompt: message, + HandleConfirm: func() error { + return gui.PopupHandler.WithWaitingStatus(gui.Tr.DeletingStatus, func() error { gui.logAction(gui.Tr.Actions.DeleteRemoteBranch) err := gui.Git.Remote.DeleteRemoteBranch(remoteBranch.RemoteName, remoteBranch.Name) - gui.handleCredentialsPopup(err) + if err != nil { + _ = gui.PopupHandler.Error(err) + } - return gui.refreshSidePanels(refreshOptions{scope: []RefreshableView{BRANCHES, REMOTES}}) + return gui.refreshSidePanels(types.RefreshOptions{Scope: []types.RefreshableView{types.BRANCHES, types.REMOTES}}) }) }, }) @@ -84,16 +88,16 @@ func (gui *Gui) handleSetBranchUpstream() error { }, ) - return gui.ask(askOpts{ - title: gui.Tr.SetUpstreamTitle, - prompt: message, - handleConfirm: func() error { + return gui.PopupHandler.Ask(popup.AskOpts{ + Title: gui.Tr.SetUpstreamTitle, + Prompt: message, + HandleConfirm: func() error { gui.logAction(gui.Tr.Actions.SetBranchUpstream) if err := gui.Git.Branch.SetUpstream(selectedBranch.RemoteName, selectedBranch.Name, checkedOutBranch.Name); err != nil { - return gui.surfaceError(err) + return gui.PopupHandler.Error(err) } - return gui.refreshSidePanels(refreshOptions{scope: []RefreshableView{BRANCHES, REMOTES}}) + return gui.refreshSidePanels(types.RefreshOptions{Scope: []types.RefreshableView{types.BRANCHES, types.REMOTES}}) }, }) } |