Skip to content

Commit

Permalink
fix(console): remove duplicate controls from async ops view (#519)
Browse files Browse the repository at this point in the history
Each screen in Tokio Console has a controls section that lists all the
possible keys that can be used to control that screen. However, on the
Resource Detail screen, there were two controls sections - one at the
top of the screen and another above the Async Ops table.

Since the controls for the Async Ops view were already included in the
Resource Detail view controls panel in #427, the controls for the Async
Ops view only needed to be removed. This simplified the layout somewhat,
as the Async Ops view now only contains a single-subview, the table
itself.

Closes #258
  • Loading branch information
devanbenz authored Feb 13, 2024
1 parent 4593222 commit f28ba4a
Showing 1 changed file with 1 addition and 21 deletions.
22 changes: 1 addition & 21 deletions tokio-console/src/view/async_ops.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ use crate::{
},
view::{
self, bold,
controls::Controls,
table::{TableList, TableListState},
DUR_LEN, DUR_TABLE_PRECISION,
},
Expand Down Expand Up @@ -195,24 +194,6 @@ impl TableList<9> for AsyncOpsTable {
table_list_state.len()
))]);

let layout = layout::Layout::default()
.direction(layout::Direction::Vertical)
.margin(0);

let controls = Controls::new(view_controls(), &area, styles);
let chunks = layout
.constraints(
[
layout::Constraint::Length(controls.height()),
layout::Constraint::Max(area.height),
]
.as_ref(),
)
.split(area);

let controls_area = chunks[0];
let async_ops_area = chunks[1];

let attributes_width = layout::Constraint::Percentage(100);
let widths = &[
id_width.constraint(),
Expand All @@ -233,8 +214,7 @@ impl TableList<9> for AsyncOpsTable {
.highlight_symbol(view::TABLE_HIGHLIGHT_SYMBOL)
.highlight_style(Style::default().add_modifier(style::Modifier::BOLD));

frame.render_stateful_widget(table, async_ops_area, &mut table_list_state.table_state);
frame.render_widget(controls.into_widget(), controls_area);
frame.render_stateful_widget(table, area, &mut table_list_state.table_state);

table_list_state
.sorted_items
Expand Down

0 comments on commit f28ba4a

Please sign in to comment.