Skip to content

Commit

Permalink
feat(console): Add way to inspect details of task from resource view (#…
Browse files Browse the repository at this point in the history
…449)

Now it is possible while navigate in `async_ops_table` to go directly to
details of the task that you are pointing on the list.

This closes #448
  • Loading branch information
guerinoni authored and hawkw committed Sep 29, 2023
1 parent e51ac5a commit 132ed4e
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 1 deletion.
20 changes: 20 additions & 0 deletions tokio-console/src/view/mod.rs
Expand Up @@ -167,6 +167,26 @@ impl View {
self.state = ResourcesList;
update_kind = UpdateKind::Other;
}
key!(Enter) => {
if let Some(op) = view.async_ops_table.selected_item().upgrade() {
if let Some(task_id) = op.borrow().task_id() {
let task = self
.tasks_list
.sorted_items
.iter()
.filter_map(|i| i.upgrade())
.find(|t| task_id == t.borrow().id());

if let Some(task) = task {
update_kind = UpdateKind::SelectTask(task.borrow().span_id());
self.state = TaskInstance(self::task::TaskView::new(
task,
state.task_details_ref(),
));
}
}
}
}
_ => {
// otherwise pass on to view
view.update_input(event);
Expand Down
2 changes: 1 addition & 1 deletion tokio-console/src/view/resource.rs
Expand Up @@ -21,7 +21,7 @@ use std::{cell::RefCell, rc::Rc};

pub(crate) struct ResourceView {
resource: Rc<RefCell<Resource>>,
async_ops_table: TableListState<AsyncOpsTable, 9>,
pub(crate) async_ops_table: TableListState<AsyncOpsTable, 9>,
initial_render: bool,
}

Expand Down

0 comments on commit 132ed4e

Please sign in to comment.