Skip to content

Commit

Permalink
feat: include name in deletion confirmation (#396)
Browse files Browse the repository at this point in the history
  • Loading branch information
GianlucaP106 authored Nov 30, 2024
1 parent 0cb4415 commit 2a7a96d
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 13 deletions.
2 changes: 1 addition & 1 deletion pkg/app/sessions.go
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ func (s *Sessions) init() {

a.refresh(nil, nil, session)
toast("Killed session "+session.Workspace.Name, toastInfo)
}, "Are you sure you want to delete the session?")
}, fmt.Sprintf("Are you sure you want to delete session for %s?", session.Workspace.Name))
}).
Set('h', "Focus workspaces view", func() {
a.workspaces.focus()
Expand Down
6 changes: 3 additions & 3 deletions pkg/app/topics.go
Original file line number Diff line number Diff line change
Expand Up @@ -179,21 +179,21 @@ func (tv *Topics) init() {
}, func() {}, "New topic name", smallEditorSize, t.Name)
}).
Set('D', "Delete topic", func() {
if a.api.TopicCount() <= 0 {
t := tv.selected()
if t == nil {
return
}
alert(func(b bool) {
if !b {
return
}
t := tv.selected()
if err := a.api.DeleteTopic(t); err != nil {
toast(err.Error(), toastError)
}

a.refreshAll()
toast("Deleted topic "+t.Name, toastInfo)
}, "Are you sure you want to delete this topic? All its content will be deleted.")
}, fmt.Sprintf("Are you sure you want to delete topic %s? All its content will be deleted.", t.Name))
}).
Set('l', "Focus workspace view", func() {
a.workspaces.focus()
Expand Down
12 changes: 3 additions & 9 deletions pkg/app/workspaces.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,13 +53,7 @@ func (w *Workspaces) getLoading() bool {

func (wv *Workspaces) focus() {
a.focusView(wv.view)
wv.showInfo()
a.worker.Queue(func() {
wv.refreshPreview()
a.ui.Update(func() {
a.preview.render()
})
})
wv.refreshDown()
}

func (wv *Workspaces) showInfo() {
Expand Down Expand Up @@ -360,7 +354,7 @@ func (wv *Workspaces) init() {
a.refresh(t, nil, nil)
toast("Deleted workspace "+curWorkspace.Name, toastInfo)
}
}, "Are you sure you want to delete this workspace?")
}, fmt.Sprintf("Are you sure you want to delete workspace %s?", curWorkspace.Name))
}).
Set('r', "Rename workspace", func() {
curWorkspace := wv.selected()
Expand Down Expand Up @@ -415,7 +409,7 @@ func (wv *Workspaces) init() {

a.refreshAll()
toast("Killed session "+curWorkspace.Name, toastInfo)
}, "Are you sure you want to delete the session?")
}, fmt.Sprintf("Are you sure you want to kill session for %s?", curWorkspace.Name))
}
}).
Set('h', "Focus topics view", func() {
Expand Down

0 comments on commit 2a7a96d

Please sign in to comment.