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(console): Add way to inspect details of task from resource view #449

Merged
merged 3 commits into from
Jul 28, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
25 changes: 25 additions & 0 deletions tokio-console/src/view/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,31 @@ 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: u64 = task_id.to_string().parse().unwrap();
let item = self
.tasks_list
.sorted_items
.iter()
.filter_map(|i| i.upgrade())
.find(|t| {
let task_id: u64 =
t.borrow().id().to_string().parse().unwrap();
task_id == task
});
guerinoni marked this conversation as resolved.
Show resolved Hide resolved

if let Some(t) = item {
update_kind = UpdateKind::SelectTask(t.borrow().span_id());
self.state = TaskInstance(self::task::TaskView::new(
t,
state.task_details_ref(),
));
}
guerinoni marked this conversation as resolved.
Show resolved Hide resolved
}
}
}
_ => {
// otherwise pass on to view
view.update_input(event);
Expand Down
2 changes: 1 addition & 1 deletion tokio-console/src/view/resource.rs
Original file line number Diff line number Diff line change
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 async_ops_table: TableListState<AsyncOpsTable, 9>,
guerinoni marked this conversation as resolved.
Show resolved Hide resolved
initial_render: bool,
}

Expand Down