handleOpenSessionBrowser opens the session browser dialog.
()
| 1278 | |
| 1279 | // handleOpenSessionBrowser opens the session browser dialog. |
| 1280 | func (m *appModel) handleOpenSessionBrowser() (tea.Model, tea.Cmd) { |
| 1281 | store := m.application.SessionStore() |
| 1282 | if store == nil { |
| 1283 | return m, notification.InfoCmd("No session store configured") |
| 1284 | } |
| 1285 | sessions, err := store.GetSessionSummaries(m.ctx()) |
| 1286 | if err != nil { |
| 1287 | return m, notification.ErrorCmd(fmt.Sprintf("Failed to load sessions: %v", err)) |
| 1288 | } |
| 1289 | if len(sessions) == 0 { |
| 1290 | return m, notification.InfoCmd("No previous sessions found") |
| 1291 | } |
| 1292 | |
| 1293 | return m, core.CmdHandler(dialog.OpenDialogMsg{ |
| 1294 | Model: dialog.NewSessionBrowserDialog(sessions), |
| 1295 | }) |
| 1296 | } |
| 1297 | |
| 1298 | // handleLoadSession loads a saved session into the current tab (if empty) or a new tab. |
| 1299 | func (m *appModel) handleLoadSession(sessionID string) (tea.Model, tea.Cmd) { |
no test coverage detected