[client] Rename logout to deregister (#4307)

This commit is contained in:
Viktor Liu
2025-08-08 15:48:30 +02:00
committed by GitHub
parent 9e95841252
commit bef99d48f8
2 changed files with 21 additions and 20 deletions

View File

@ -12,8 +12,9 @@ import (
) )
var logoutCmd = &cobra.Command{ var logoutCmd = &cobra.Command{
Use: "logout", Use: "deregister",
Short: "logout from the NetBird Management Service and delete peer", Aliases: []string{"logout"},
Short: "deregister from the NetBird Management Service and delete peer",
RunE: func(cmd *cobra.Command, args []string) error { RunE: func(cmd *cobra.Command, args []string) error {
SetFlagsFromEnvVars(rootCmd) SetFlagsFromEnvVars(rootCmd)
@ -44,10 +45,10 @@ var logoutCmd = &cobra.Command{
} }
if _, err := daemonClient.Logout(ctx, req); err != nil { if _, err := daemonClient.Logout(ctx, req); err != nil {
return fmt.Errorf("logout: %v", err) return fmt.Errorf("deregister: %v", err)
} }
cmd.Println("Logged out successfully") cmd.Println("Deregistered successfully")
return nil return nil
}, },
} }

View File

@ -46,7 +46,7 @@ func (s *serviceClient) showProfilesUI() {
widget.NewLabel(""), // profile name widget.NewLabel(""), // profile name
layout.NewSpacer(), layout.NewSpacer(),
widget.NewButton("Select", nil), widget.NewButton("Select", nil),
widget.NewButton("Logout", nil), widget.NewButton("Deregister", nil),
widget.NewButton("Remove", nil), widget.NewButton("Remove", nil),
) )
}, },
@ -128,7 +128,7 @@ func (s *serviceClient) showProfilesUI() {
} }
logoutBtn.Show() logoutBtn.Show()
logoutBtn.SetText("Logout") logoutBtn.SetText("Deregister")
logoutBtn.OnTapped = func() { logoutBtn.OnTapped = func() {
s.handleProfileLogout(profile.Name, refresh) s.handleProfileLogout(profile.Name, refresh)
} }
@ -334,8 +334,8 @@ func (s *serviceClient) getProfiles() ([]Profile, error) {
func (s *serviceClient) handleProfileLogout(profileName string, refreshCallback func()) { func (s *serviceClient) handleProfileLogout(profileName string, refreshCallback func()) {
dialog.ShowConfirm( dialog.ShowConfirm(
"Logout", "Deregister",
fmt.Sprintf("Are you sure you want to logout from '%s'?", profileName), fmt.Sprintf("Are you sure you want to deregister from '%s'?", profileName),
func(confirm bool) { func(confirm bool) {
if !confirm { if !confirm {
return return
@ -362,13 +362,13 @@ func (s *serviceClient) handleProfileLogout(profileName string, refreshCallback
}) })
if err != nil { if err != nil {
log.Errorf("logout failed: %v", err) log.Errorf("logout failed: %v", err)
dialog.ShowError(fmt.Errorf("logout failed"), s.wProfiles) dialog.ShowError(fmt.Errorf("deregister failed"), s.wProfiles)
return return
} }
dialog.ShowInformation( dialog.ShowInformation(
"Logged Out", "Deregistered",
fmt.Sprintf("Successfully logged out from '%s'", profileName), fmt.Sprintf("Successfully deregistered from '%s'", profileName),
s.wProfiles, s.wProfiles,
) )
@ -602,7 +602,7 @@ func (p *profileMenu) refresh() {
// Add Logout menu item // Add Logout menu item
ctx2, cancel2 := context.WithCancel(context.Background()) ctx2, cancel2 := context.WithCancel(context.Background())
logoutItem := p.profileMenuItem.AddSubMenuItem("Logout", "") logoutItem := p.profileMenuItem.AddSubMenuItem("Deregister", "")
p.logoutSubItem = &subItem{logoutItem, ctx2, cancel2} p.logoutSubItem = &subItem{logoutItem, ctx2, cancel2}
go func() { go func() {
@ -616,9 +616,9 @@ func (p *profileMenu) refresh() {
} }
if err := p.eventHandler.logout(p.ctx); err != nil { if err := p.eventHandler.logout(p.ctx); err != nil {
log.Errorf("logout failed: %v", err) log.Errorf("logout failed: %v", err)
p.app.SendNotification(fyne.NewNotification("Error", "Failed to logout")) p.app.SendNotification(fyne.NewNotification("Error", "Failed to deregister"))
} else { } else {
p.app.SendNotification(fyne.NewNotification("Success", "Logged out successfully")) p.app.SendNotification(fyne.NewNotification("Success", "Deregistered successfully"))
} }
} }
} }