refactor(picker): shorten remote session status
- commit
- 5d58f8a2727fbeb283cb505b7321690b67b396fe
- author
- brice · · 2026-08-10 04:42 UTC
- parent
- fe8474f
- signature
- GPG Verified
CD88F9E564E0102646FB6077A1A07C7C7C3E349D· arch-gpg Verified for the committer email
2 files · +11 -4
M internal/usecase/daemon/remote_picker.go +1 -4
| @@ -210,10 +210,7 @@ func remotePickerView(key domain.RemoteSessionKey, session ports.RemoteCatalogSe | |||
| 210 | 210 | if detail == "" { | |
| 211 | 211 | switch session.State { | |
| 212 | 212 | case "up": | |
| 213 | - | detail = "running" | |
| 214 | - | if session.Attached { | |
| 215 | - | detail += " · attached" | |
| 216 | - | } | |
| 213 | + | detail = "up" | |
| 217 | 214 | case "down", "stopped": | |
| 218 | 215 | detail = "stopped" | |
| 219 | 216 | case "broken": | |
| @@ -210,10 +210,7 @@ func remotePickerView(key domain.RemoteSessionKey, session ports.RemoteCatalogSe | |||||
| 210 | if detail == "" { | 210 | if detail == "" { | ||
| 211 | switch session.State { | 211 | switch session.State { | ||
| 212 | case "up": | 212 | case "up": | ||
| 213 | - | detail = "running" | 213 | + | detail = "up" |
| 214 | - | if session.Attached { | |||
| 215 | - | detail += " · attached" | |||
| 216 | - | } | |||
| 217 | case "down", "stopped": | 214 | case "down", "stopped": | ||
| 218 | detail = "stopped" | 215 | detail = "stopped" | ||
| 219 | case "broken": | 216 | case "broken": | ||
M internal/usecase/daemon/remote_picker_test.go +10 -0
| @@ -82,6 +82,16 @@ func TestRemotePickerStoppedRowsUseCanonicalStateAndSafeSelection(t *testing.T) | |||
| 82 | 82 | } | |
| 83 | 83 | } | |
| 84 | 84 | ||
| 85 | + | func TestRemotePickerUsesCompactUpDetailRegardlessOfAttachment(t *testing.T) { | |
| 86 | + | for _, attached := range []bool{false, true} { | |
| 87 | + | view := remotePickerView(domain.RemoteSessionKey{Host: "remote", Name: "work"}, ports.RemoteCatalogSession{ | |
| 88 | + | LifecycleID: remoteLifecycleForTest(), Name: "work", State: "up", Attached: attached, | |
| 89 | + | Tabs: []ports.RemoteCatalogTab{{ID: "tab-1", Index: 0}}, | |
| 90 | + | }, remoteHostFresh, time.Now()) | |
| 91 | + | require.Equal(t, "up", view.RemoteDetail) | |
| 92 | + | } | |
| 93 | + | } | |
| 94 | + | ||
| 85 | 95 | func TestRemotePickerDeduplicatesSameLifecycleReachedThroughHostAliases(t *testing.T) { | |
| 86 | 96 | store := &remoteRefreshHostStore{hosts: []string{"remote", "vev@remote"}} | |
| 87 | 97 | d := newRemotePickerDaemon(store) | |
| @@ -82,6 +82,16 @@ func TestRemotePickerStoppedRowsUseCanonicalStateAndSafeSelection(t *testing.T) | |||||
| 82 | } | 82 | } | ||
| 83 | } | 83 | } | ||
| 84 | 84 | ||||
| 85 | + | func TestRemotePickerUsesCompactUpDetailRegardlessOfAttachment(t *testing.T) { | |||
| 86 | + | for _, attached := range []bool{false, true} { | |||
| 87 | + | view := remotePickerView(domain.RemoteSessionKey{Host: "remote", Name: "work"}, ports.RemoteCatalogSession{ | |||
| 88 | + | LifecycleID: remoteLifecycleForTest(), Name: "work", State: "up", Attached: attached, | |||
| 89 | + | Tabs: []ports.RemoteCatalogTab{{ID: "tab-1", Index: 0}}, | |||
| 90 | + | }, remoteHostFresh, time.Now()) | |||
| 91 | + | require.Equal(t, "up", view.RemoteDetail) | |||
| 92 | + | } | |||
| 93 | + | } | |||
| 94 | + | ||||
| 85 | func TestRemotePickerDeduplicatesSameLifecycleReachedThroughHostAliases(t *testing.T) { | 95 | func TestRemotePickerDeduplicatesSameLifecycleReachedThroughHostAliases(t *testing.T) { | ||
| 86 | store := &remoteRefreshHostStore{hosts: []string{"remote", "vev@remote"}} | 96 | store := &remoteRefreshHostStore{hosts: []string{"remote", "vev@remote"}} | ||
| 87 | d := newRemotePickerDaemon(store) | 97 | d := newRemotePickerDaemon(store) | ||