Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion src/cortex-tui/src/views/tasks.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@ use ratatui::widgets::{Block, Borders, Cell, Clear, Paragraph, Row, Table};
use cortex_agents::background::{AgentStatus, RunningAgentInfo};
use cortex_common::{format_duration, truncate_first_line, truncate_id_default};

const EMPTY_TASKS_MESSAGE: &str =
"No background tasks are running.\n\nPress Ctrl+B to run the current prompt in background.";

/// View for displaying background tasks/agents.
pub struct TasksView {
/// List of agents to display.
Expand Down Expand Up @@ -95,7 +98,7 @@ impl TasksView {

if self.agents.is_empty() {
// Show empty state
let empty_text = Paragraph::new("No background tasks running.\n\nPress Ctrl+B to run the current prompt in background.")
let empty_text = Paragraph::new(EMPTY_TASKS_MESSAGE)
.style(Style::default().fg(Color::DarkGray))
.alignment(Alignment::Center);

Expand Down Expand Up @@ -227,6 +230,11 @@ mod tests {
assert_eq!(view.agent_count(), 0);
}

#[test]
fn test_empty_tasks_message_is_grammatical() {
assert!(EMPTY_TASKS_MESSAGE.starts_with("No background tasks are running."));
}

#[test]
fn test_tasks_view_set_agents() {
let mut view = TasksView::new();
Expand Down