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

enable the view switching keystrokes on the details views #387

Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

15 changes: 9 additions & 6 deletions tokio-console/src/view/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,15 @@ impl View {
pub(crate) fn update_input(&mut self, event: input::Event, state: &State) -> UpdateKind {
use ViewState::*;
let mut update_kind = UpdateKind::Other;

if matches!(event, key!(Char('t'))) {
self.state = TasksList;
return update_kind;
}
if matches!(event, key!(Char('r'))) {
self.state = ResourcesList;
return update_kind;
}
hawkw marked this conversation as resolved.
Show resolved Hide resolved
match self.state {
TasksList => {
// The enter key changes views, so handle here since we can
Expand All @@ -110,9 +119,6 @@ impl View {
));
}
}
key!(Char('r')) => {
self.state = ResourcesList;
}
_ => {
// otherwise pass on to view
self.tasks_list.update_input(event);
Expand All @@ -127,9 +133,6 @@ impl View {
self.state = ResourceInstance(self::resource::ResourceView::new(res));
}
}
key!(Char('t')) => {
self.state = TasksList;
}
_ => {
// otherwise pass on to view
self.resources_list.update_input(event);
Expand Down