Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(turborepo): task table width bug #8868

Merged
merged 1 commit into from
Jul 29, 2024
Merged
Show file tree
Hide file tree
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
6 changes: 1 addition & 5 deletions crates/turborepo-lib/src/cli/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,7 @@ use turbopath::AbsoluteSystemPathBuf;
use turborepo_api_client::AnonAPIClient;
use turborepo_repository::inference::{RepoMode, RepoState};
use turborepo_telemetry::{
events::{
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't be in this PR but I was getting an unused import warning

command::{CodePath, CommandEventBuilder},
generic::GenericEventBuilder,
EventBuilder, EventType,
},
events::{command::CommandEventBuilder, generic::GenericEventBuilder, EventBuilder, EventType},
init_telemetry, track_usage, TelemetryHandle,
};
use turborepo_ui::{GREY, UI};
Expand Down
6 changes: 0 additions & 6 deletions crates/turborepo-telemetry/src/events/command.rs
Original file line number Diff line number Diff line change
Expand Up @@ -48,12 +48,6 @@ impl EventBuilder for CommandEventBuilder {

// events

#[derive(Debug, Clone, Serialize, Deserialize)]
pub enum CodePath {
Go,
Rust,
}

#[derive(Debug, Clone, Serialize, Deserialize, Copy)]
pub enum LoginMethod {
SSO,
Expand Down
21 changes: 13 additions & 8 deletions crates/turborepo-ui/src/tui/table.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ pub struct TaskTable<'b> {
spinner: SpinnerState,
}

const TASK_NAVIGATE_INSTRUCTIONS: &str = "↑ ↓ to navigate";

impl<'b> TaskTable<'b> {
/// Construct a new table with all of the planned tasks
pub fn new(tasks_by_type: &'b TasksByStatus) -> Self {
Expand All @@ -31,9 +33,9 @@ impl<'b> TaskTable<'b> {
.map(|task| task.len())
.max()
.unwrap_or_default()
// Task column width should be large enough to fit "↑ ↓ to select task" instructions
// Task column width should be large enough to fit "↑ ↓ to navigate instructions
// and truncate tasks with more than 40 chars.
.clamp(13, 40) as u16;
.clamp(TASK_NAVIGATE_INSTRUCTIONS.len(), 40) as u16;
// Add space for column divider and status emoji
task_name_width + 1
}
Expand Down Expand Up @@ -83,7 +85,7 @@ impl<'a> StatefulWidget for &'a TaskTable<'a> {
.chain(self.planned_rows())
.chain(self.finished_rows()),
[
Constraint::Min(14),
Constraint::Min(15),
// Status takes one cell to render
Constraint::Length(1),
],
Expand All @@ -98,11 +100,14 @@ impl<'a> StatefulWidget for &'a TaskTable<'a> {
.height(2),
)
.footer(
vec![format!("{bar}\n↑ ↓ to navigate"), "─\n ".to_owned()]
.into_iter()
.map(Cell::from)
.collect::<Row>()
.height(2),
vec![
format!("{bar}\n{TASK_NAVIGATE_INSTRUCTIONS}"),
format!("─\n "),
]
.into_iter()
.map(Cell::from)
.collect::<Row>()
.height(2),
);
StatefulWidget::render(table, area, buf, state);
}
Expand Down
Loading