Skip to content

Commit 639e03b

Browse files
authored
feat(console): Add way to inspect details of task from resource view (#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
1 parent f4536af commit 639e03b

File tree

2 files changed

+21
-1
lines changed

2 files changed

+21
-1
lines changed

tokio-console/src/view/mod.rs

+20
Original file line numberDiff line numberDiff line change
@@ -167,6 +167,26 @@ impl View {
167167
self.state = ResourcesList;
168168
update_kind = UpdateKind::Other;
169169
}
170+
key!(Enter) => {
171+
if let Some(op) = view.async_ops_table.selected_item().upgrade() {
172+
if let Some(task_id) = op.borrow().task_id() {
173+
let task = self
174+
.tasks_list
175+
.sorted_items
176+
.iter()
177+
.filter_map(|i| i.upgrade())
178+
.find(|t| task_id == t.borrow().id());
179+
180+
if let Some(task) = task {
181+
update_kind = UpdateKind::SelectTask(task.borrow().span_id());
182+
self.state = TaskInstance(self::task::TaskView::new(
183+
task,
184+
state.task_details_ref(),
185+
));
186+
}
187+
}
188+
}
189+
}
170190
_ => {
171191
// otherwise pass on to view
172192
view.update_input(event);

tokio-console/src/view/resource.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ use std::{cell::RefCell, rc::Rc};
2121

2222
pub(crate) struct ResourceView {
2323
resource: Rc<RefCell<Resource>>,
24-
async_ops_table: TableListState<AsyncOpsTable, 9>,
24+
pub(crate) async_ops_table: TableListState<AsyncOpsTable, 9>,
2525
initial_render: bool,
2626
}
2727

0 commit comments

Comments
 (0)