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

feat(turborepo): new ui + watch mode #7962

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

NicholasLYang
Copy link
Contributor

@NicholasLYang NicholasLYang commented Apr 15, 2024

Description

Integrates new UI with watch mode. Pulls out the UI handle and sender outside the Visitor and Run struct, so it can be owned by the WatchClient. Also adds an Event for updating the task names, so on rediscovery we can keep using the same UI thread but just update the task names.

Testing Instructions

Give it a shot!

Closes TURBO-2801

Copy link
Contributor Author

NicholasLYang commented Apr 15, 2024

This stack of pull requests is managed by Graphite. Learn more about stacking.

Join @NicholasLYang and the rest of your teammates on Graphite Graphite

Copy link

vercel bot commented Apr 15, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
examples-nonmonorepo ✅ Ready (Inspect) Visit Preview 💬 Add feedback May 10, 2024 9:55pm
examples-svelte-web 🔄 Building (Inspect) Visit Preview 💬 Add feedback May 10, 2024 9:55pm
rust-docs ✅ Ready (Inspect) Visit Preview 💬 Add feedback May 10, 2024 9:55pm
turbo-turbo-tracing-next-plugin ❌ Failed (Inspect) May 10, 2024 9:55pm
7 Ignored Deployments
Name Status Preview Comments Updated (UTC)
examples-basic-web ⬜️ Ignored (Inspect) Visit Preview May 10, 2024 9:55pm
examples-designsystem-docs ⬜️ Ignored (Inspect) Visit Preview May 10, 2024 9:55pm
examples-gatsby-web ⬜️ Ignored (Inspect) Visit Preview May 10, 2024 9:55pm
examples-kitchensink-blog ⬜️ Ignored (Inspect) Visit Preview May 10, 2024 9:55pm
examples-native-web ⬜️ Ignored (Inspect) Visit Preview May 10, 2024 9:55pm
examples-tailwind-web ⬜️ Ignored (Inspect) Visit Preview May 10, 2024 9:55pm
examples-vite-web ⬜️ Ignored (Inspect) Visit Preview May 10, 2024 9:55pm

Copy link
Contributor

github-actions bot commented Apr 15, 2024

🟢 Turbopack Benchmark CI successful 🟢

Thanks

Copy link
Contributor

github-actions bot commented Apr 15, 2024

⚠️ CI failed ⚠️

The following steps have failed in CI:

  • Turborepo Rust checks

See workflow summary for details

@NicholasLYang NicholasLYang force-pushed the nicholasyang/watch-with-experimental-ui branch from 09b44be to c090c69 Compare April 16, 2024 14:54
@NicholasLYang NicholasLYang force-pushed the nicholasyang/watch-with-experimental-ui branch from c090c69 to 2050124 Compare April 17, 2024 19:22
@NicholasLYang NicholasLYang force-pushed the nicholasyang/watch-with-experimental-ui branch from 2050124 to c69ac3a Compare April 18, 2024 17:11
@NicholasLYang NicholasLYang force-pushed the nicholasyang/watch-with-experimental-ui branch from c69ac3a to e8ceb6f Compare April 18, 2024 17:19
@NicholasLYang NicholasLYang force-pushed the nicholasyang/watch-with-experimental-ui branch from e8ceb6f to 53a852f Compare April 19, 2024 16:20
@NicholasLYang NicholasLYang changed the title Trying to get experimental UI working with watch mode feat(turborepo): new ui + watch mode May 10, 2024
@NicholasLYang NicholasLYang marked this pull request as ready for review May 10, 2024 19:26
@NicholasLYang NicholasLYang requested a review from a team as a code owner May 10, 2024 19:26
Copy link
Contributor

@chris-olszewski chris-olszewski left a comment

Choose a reason for hiding this comment

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

Overall this looks good, primarily concerned with testing the state machine that is our UI.

self.state.start
}
pub fn start(self) -> Task<Running> {
Copy link
Contributor

Choose a reason for hiding this comment

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

This feels off, do we want to start running tasks again vs creating a new task and having it go through the natural progression of planned -> running -> finished?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ahh yeah that makes more sense

@@ -77,6 +77,10 @@ impl<I> App<I> {
pub fn term_size(&self) -> (u16, u16) {
self.pane.term_size()
}

pub fn update_tasks(&mut self, tasks: Vec<String>) {
self.table = TaskTable::new(tasks.clone());
Copy link
Contributor

Choose a reason for hiding this comment

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

We need to be clearing and updating the panes in some way as well. Right now they get reused so task output from a previous run is still displayed.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Is that bad? I kind of like seeing the previous runs, so you can understand that something got re-run. If a task completes too quickly, it could end up showing the same output which would confuse people

crates/turborepo-ui/src/tui/handle.rs Outdated Show resolved Hide resolved
@@ -77,6 +77,10 @@ impl<I> App<I> {
pub fn term_size(&self) -> (u16, u16) {
self.pane.term_size()
}

pub fn update_tasks(&mut self, tasks: Vec<String>) {
self.table = TaskTable::new(tasks.clone());
Copy link
Contributor

Choose a reason for hiding this comment

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

Due to a prior hack, there should be self.next() as otherwise the table might be out of sync with the pane. i.e. display wrong pane for selected task in table

self.scroll.select(Some(selected_idx + 1));
}
}
} else {
Copy link
Contributor

Choose a reason for hiding this comment

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

So if a task gets restarted while it's still running it will error?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

That's currently not possible. We purposefully make it so the same task can't be run at the same time, and we haven't implemented cancelation logic. If a change event happens in the middle of a run, we save it and wait for the run to finish before starting up a new execution.

.iter()
.position(|finished_task| finished_task.name() == task)
{
let finished = self.finished.remove(finished_idx);
Copy link
Contributor

Choose a reason for hiding this comment

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

I think some unit tests would be a good fit here.

Co-authored-by: Chris Olszewski <chris.olszewski@vercel.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants