Add popup notifications, log view (F5) and context-sensitive key hints (M9)
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
+16
-12
@@ -3,7 +3,6 @@ package ui
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"strings"
|
||||
"sync"
|
||||
"time"
|
||||
|
||||
@@ -124,6 +123,7 @@ func newDownloadsView(app *App, sab *sabnzbd.Client, sources []arrSource, interv
|
||||
// nextPanel moves focus to the next (dir 1) or previous (dir -1) panel:
|
||||
// queue, Radarr/Sonarr queue, history.
|
||||
func (v *downloadsView) nextPanel(dir int) {
|
||||
defer v.app.renderStatus()
|
||||
cur := v.app.app.GetFocus()
|
||||
for i, p := range v.panels {
|
||||
if p == cur {
|
||||
@@ -201,11 +201,8 @@ func (v *downloadsView) refresh(ctx context.Context) {
|
||||
}
|
||||
|
||||
v.app.post(func() {
|
||||
var errs []string
|
||||
v.app.SetService("SABnzbd", "", qerr)
|
||||
if qerr != nil {
|
||||
errs = append(errs, "SABnzbd: "+qerr.Error())
|
||||
} else {
|
||||
if qerr == nil {
|
||||
v.sabQueue, v.slots, v.paused = queue, queue.Slots, queue.Paused
|
||||
v.renderQueue()
|
||||
}
|
||||
@@ -215,18 +212,13 @@ func (v *downloadsView) refresh(ctx context.Context) {
|
||||
}
|
||||
for i, s := range v.sources {
|
||||
v.app.SetService(s.name, "", arrs[i].err)
|
||||
if arrs[i].err != nil {
|
||||
errs = append(errs, s.name+": "+arrs[i].err.Error())
|
||||
continue
|
||||
if arrs[i].err == nil {
|
||||
v.arrItems[s.name] = arrs[i].items
|
||||
}
|
||||
v.arrItems[s.name] = arrs[i].items
|
||||
}
|
||||
v.rebuildArrRows()
|
||||
v.renderArr()
|
||||
v.renderSummary()
|
||||
if len(errs) > 0 {
|
||||
v.app.SetMessage("[red]" + tview.Escape(strings.Join(errs, " · ")))
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
@@ -524,3 +516,15 @@ func (v *downloadsView) removeArr(blocklist bool) {
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
// hints lists the keys of the focused panel.
|
||||
func (v *downloadsView) hints() string {
|
||||
common := "p pause/resume · r refresh · Tab next panel"
|
||||
switch v.app.app.GetFocus() {
|
||||
case v.arrQueue:
|
||||
return "d remove · b remove + blocklist · " + common
|
||||
case v.history:
|
||||
return "d delete · t retry failed · " + common
|
||||
}
|
||||
return "d delete job · " + common
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user