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/tags_panel.go | |
parent | fa8571e1f4c349e401542285ea238acdbd9d17ec (diff) |
start refactoring gui
Diffstat (limited to 'pkg/gui/tags_panel.go')
-rw-r--r-- | pkg/gui/tags_panel.go | 32 |
1 files changed, 18 insertions, 14 deletions
diff --git a/pkg/gui/tags_panel.go b/pkg/gui/tags_panel.go index efad33fbf..9f516a006 100644 --- a/pkg/gui/tags_panel.go +++ b/pkg/gui/tags_panel.go @@ -2,6 +2,8 @@ package gui import ( "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" ) @@ -41,7 +43,7 @@ func (gui *Gui) tagsRenderToMain() error { func (gui *Gui) refreshTags() error { tags, err := gui.Git.Loaders.Tags.GetTags() if err != nil { - return gui.surfaceError(err) + return gui.PopupHandler.Error(err) } gui.State.Tags = tags @@ -78,15 +80,15 @@ func (gui *Gui) handleDeleteTag(tag *models.Tag) error { }, ) - return gui.ask(askOpts{ - title: gui.Tr.DeleteTagTitle, - prompt: prompt, - handleConfirm: func() error { + return gui.PopupHandler.Ask(popup.AskOpts{ + Title: gui.Tr.DeleteTagTitle, + Prompt: prompt, + HandleConfirm: func() error { gui.logAction(gui.Tr.Actions.DeleteTag) if err := gui.Git.Tag.Delete(tag.Name); err != nil { - return gui.surfaceError(err) + return gui.PopupHandler.Error(err) } - return gui.refreshSidePanels(refreshOptions{mode: ASYNC, scope: []RefreshableView{COMMITS, TAGS}}) + return gui.refreshSidePanels(types.RefreshOptions{Mode: types.ASYNC, Scope: []types.RefreshableView{types.COMMITS, types.TAGS}}) }, }) } @@ -99,15 +101,17 @@ func (gui *Gui) handlePushTag(tag *models.Tag) error { }, ) - return gui.prompt(promptOpts{ - title: title, - initialContent: "origin", - findSuggestionsFunc: gui.getRemoteSuggestionsFunc(), - handleConfirm: func(response string) error { - return gui.WithWaitingStatus(gui.Tr.PushingTagStatus, func() error { + return gui.PopupHandler.Prompt(popup.PromptOpts{ + Title: title, + InitialContent: "origin", + FindSuggestionsFunc: gui.getRemoteSuggestionsFunc(), + HandleConfirm: func(response string) error { + return gui.PopupHandler.WithWaitingStatus(gui.Tr.PushingTagStatus, func() error { gui.logAction(gui.Tr.Actions.PushTag) err := gui.Git.Tag.Push(response, tag.Name) - gui.handleCredentialsPopup(err) + if err != nil { + _ = gui.PopupHandler.Error(err) + } return nil }) |