Small fixes
All checks were successful
Multi-Platform Release Build / build (false, linux/arm64, native) (push) Successful in 13m20s
Multi-Platform Release Build / build (true, build-essential gcc-x86-64-linux-gnu libc6-dev-amd64-cross pkg-config binutils-x86-64-linux-gnu, map[CARGO_TARGET_X86_64_UNKNOWN_LINUX_GNU_LINKER:x86_64-linux-gnu-gcc], linux/amd64, x86_64-unknown-linux-gnu) (push) Successful in 10m58s
Multi-Platform Release Build / build (true, gcc-mingw-w64-x86-64 g++-mingw-w64-x86-64 cmake nasm, map[CARGO_TARGET_X86_64_PC_WINDOWS_GNU_LINKER:x86_64-w64-mingw32-gcc CC_x86_64_pc_windows_gnu:x86_64-w64-mingw32-gcc], linux/amd64, x86_64-pc-windows-gnu) (push) Successful in 13m31s
Multi-Platform Release Build / create-release (push) Successful in 1m1s
All checks were successful
Multi-Platform Release Build / build (false, linux/arm64, native) (push) Successful in 13m20s
Multi-Platform Release Build / build (true, build-essential gcc-x86-64-linux-gnu libc6-dev-amd64-cross pkg-config binutils-x86-64-linux-gnu, map[CARGO_TARGET_X86_64_UNKNOWN_LINUX_GNU_LINKER:x86_64-linux-gnu-gcc], linux/amd64, x86_64-unknown-linux-gnu) (push) Successful in 10m58s
Multi-Platform Release Build / build (true, gcc-mingw-w64-x86-64 g++-mingw-w64-x86-64 cmake nasm, map[CARGO_TARGET_X86_64_PC_WINDOWS_GNU_LINKER:x86_64-w64-mingw32-gcc CC_x86_64_pc_windows_gnu:x86_64-w64-mingw32-gcc], linux/amd64, x86_64-pc-windows-gnu) (push) Successful in 13m31s
Multi-Platform Release Build / create-release (push) Successful in 1m1s
This commit is contained in:
parent
60e4fa3b9d
commit
6109785e63
1 changed files with 17 additions and 9 deletions
|
|
@ -28,6 +28,7 @@ pub fn render_monitor_list(main_frame: &mut Frame, area: Rect, state: &mut Dashb
|
||||||
let mut current_y = area.y as usize;
|
let mut current_y = area.y as usize;
|
||||||
let mut rendered_height = 0;
|
let mut rendered_height = 0;
|
||||||
let mut lines_skipped = 0;
|
let mut lines_skipped = 0;
|
||||||
|
let half = state.get_total_lenght().saturating_div(2);
|
||||||
|
|
||||||
for (i, group) in state.groups.iter().enumerate() {
|
for (i, group) in state.groups.iter().enumerate() {
|
||||||
let group_height = group.monitors.len() + BORDER_LINES_VIEW;
|
let group_height = group.monitors.len() + BORDER_LINES_VIEW;
|
||||||
|
|
@ -55,7 +56,7 @@ pub fn render_monitor_list(main_frame: &mut Frame, area: Rect, state: &mut Dashb
|
||||||
main_frame,
|
main_frame,
|
||||||
group_area,
|
group_area,
|
||||||
group,
|
group,
|
||||||
i == 0 && lines_skipped >= scroll_pos,
|
half > rendered_height ,
|
||||||
);
|
);
|
||||||
|
|
||||||
current_y += visible_height;
|
current_y += visible_height;
|
||||||
|
|
@ -64,7 +65,7 @@ pub fn render_monitor_list(main_frame: &mut Frame, area: Rect, state: &mut Dashb
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn render_group(frame: &mut Frame, area: Rect, group: &GroupViewState, is_first: bool) {
|
fn render_group(frame: &mut Frame, area: Rect, group: &GroupViewState, is_first_half: bool) {
|
||||||
let chunks = Layout::default()
|
let chunks = Layout::default()
|
||||||
.direction(Direction::Vertical)
|
.direction(Direction::Vertical)
|
||||||
.margin(0)
|
.margin(0)
|
||||||
|
|
@ -84,11 +85,7 @@ fn render_group(frame: &mut Frame, area: Rect, group: &GroupViewState, is_first:
|
||||||
]);
|
]);
|
||||||
|
|
||||||
let title_block = Block::default()
|
let title_block = Block::default()
|
||||||
.borders(if is_first {
|
.borders(Borders::ALL)
|
||||||
Borders::TOP | Borders::LEFT | Borders::RIGHT
|
|
||||||
} else {
|
|
||||||
Borders::ALL
|
|
||||||
})
|
|
||||||
.border_style(Style::default().fg(Color::Blue))
|
.border_style(Style::default().fg(Color::Blue))
|
||||||
.title(group_title)
|
.title(group_title)
|
||||||
.title_alignment(Alignment::Left);
|
.title_alignment(Alignment::Left);
|
||||||
|
|
@ -96,13 +93,24 @@ fn render_group(frame: &mut Frame, area: Rect, group: &GroupViewState, is_first:
|
||||||
frame.render_widget(title_block, chunks[0]);
|
frame.render_widget(title_block, chunks[0]);
|
||||||
|
|
||||||
if !group.monitors.is_empty() {
|
if !group.monitors.is_empty() {
|
||||||
render_monitor_table(frame, chunks[1], &group.monitors);
|
render_monitor_table(frame, chunks[1], &group.monitors, is_first_half);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn render_monitor_table(frame: &mut Frame, area: Rect, monitors: &Vec<MonitorViewState>) {
|
fn render_monitor_table(
|
||||||
|
frame: &mut Frame,
|
||||||
|
area: Rect,
|
||||||
|
monitors: &Vec<MonitorViewState>,
|
||||||
|
is_first_half: bool,
|
||||||
|
) {
|
||||||
let max_items = area.height as usize;
|
let max_items = area.height as usize;
|
||||||
let items_to_show = min(monitors.len(), max_items);
|
let items_to_show = min(monitors.len(), max_items);
|
||||||
|
let index = monitors.len().saturating_sub(max_items.saturating_sub(2)); // 2 = Table header + botton
|
||||||
|
let monitors = if is_first_half {
|
||||||
|
&monitors[index..].to_vec()
|
||||||
|
} else {
|
||||||
|
monitors
|
||||||
|
};
|
||||||
|
|
||||||
let header_cells = vec![
|
let header_cells = vec![
|
||||||
"".to_string(),
|
"".to_string(),
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue