fixed a bug in project promotion where the folder for the project name
would be duplicated, and added rustbuster to the rust tools available!
This commit is contained in:
+61
-11
@@ -6,6 +6,7 @@ use crossterm::{
|
||||
terminal::{EnterAlternateScreen, LeaveAlternateScreen, disable_raw_mode, enable_raw_mode},
|
||||
};
|
||||
use ratatui::{
|
||||
layout::{Constraint, Layout},
|
||||
prelude::*,
|
||||
widgets::{Block, Borders, List, ListItem, ListState, Paragraph},
|
||||
};
|
||||
@@ -248,19 +249,68 @@ pub fn run_tui(
|
||||
state.config.get(setting).unwrap()
|
||||
)));
|
||||
}
|
||||
let info_area_height = top_chunks[1].height.saturating_sub(2) as usize;
|
||||
if state.info_scroll as usize > info_lines.len().saturating_sub(info_area_height) {
|
||||
state.info_scroll = info_lines.len().saturating_sub(info_area_height) as u16;
|
||||
}
|
||||
let info_paragraph = Paragraph::new(info_lines)
|
||||
.block(
|
||||
if state.progress_bars.is_empty() {
|
||||
let info_area_height = top_chunks[2].height.saturating_sub(2) as usize;
|
||||
if state.info_scroll as usize > info_lines.len().saturating_sub(info_area_height) {
|
||||
state.info_scroll = info_lines.len().saturating_sub(info_area_height) as u16;
|
||||
}
|
||||
let info_paragraph = Paragraph::new(info_lines)
|
||||
.block(
|
||||
Block::default()
|
||||
.borders(Borders::ALL)
|
||||
.title("Selected Project Information"),
|
||||
)
|
||||
.scroll((state.info_scroll, 0))
|
||||
.wrap(ratatui::widgets::Wrap { trim: false });
|
||||
f.render_widget(info_paragraph, top_chunks[2]);
|
||||
} else {
|
||||
let progress_section = Layout::default()
|
||||
.direction(Direction::Vertical)
|
||||
.constraints([Constraint::Percentage(60), Constraint::Percentage(40)])
|
||||
.split(top_chunks[2]);
|
||||
let info_area_height = top_chunks[2].height.saturating_sub(2) as usize;
|
||||
if state.info_scroll as usize > info_lines.len().saturating_sub(info_area_height) {
|
||||
state.info_scroll = info_lines.len().saturating_sub(info_area_height) as u16;
|
||||
}
|
||||
let info_paragraph = Paragraph::new(info_lines)
|
||||
.block(
|
||||
Block::default()
|
||||
.borders(Borders::ALL)
|
||||
.title("Selected Project Information"),
|
||||
)
|
||||
.scroll((state.info_scroll, 0))
|
||||
.wrap(ratatui::widgets::Wrap { trim: false });
|
||||
f.render_widget(info_paragraph, progress_section[0]);
|
||||
let mut progress_lines = Vec::new();
|
||||
state.progress_bars.iter().for_each(|progress| {
|
||||
if let Ok(status) = progress.read() {
|
||||
let percentage = status.complete / status.total * 100;
|
||||
if percentage == 100 {
|
||||
progress_lines.push(Line::from(Span::styled(
|
||||
format!(
|
||||
"{} - {}/{} ({}%)",
|
||||
status.name, status.complete, status.total, percentage
|
||||
),
|
||||
Style::default().fg(Color::Green),
|
||||
)));
|
||||
} else {
|
||||
progress_lines.push(Line::from(Span::styled(
|
||||
format!(
|
||||
"{} - {}/{} ({}%)",
|
||||
status.name, status.complete, status.total, percentage
|
||||
),
|
||||
Style::default().fg(Color::Magenta),
|
||||
)));
|
||||
}
|
||||
}
|
||||
});
|
||||
let progress_paragraph = Paragraph::new(progress_lines).block(
|
||||
Block::default()
|
||||
.borders(Borders::ALL)
|
||||
.title("Selected Project Information"),
|
||||
)
|
||||
.scroll((state.info_scroll, 0))
|
||||
.wrap(ratatui::widgets::Wrap { trim: false });
|
||||
f.render_widget(info_paragraph, top_chunks[2]);
|
||||
.title("Operations in progress"),
|
||||
);
|
||||
f.render_widget(progress_paragraph, progress_section[1]);
|
||||
}
|
||||
let mut output_lines = Vec::new();
|
||||
state.output.iter().for_each(|text| {
|
||||
let line = Line::from(Span::raw(text));
|
||||
|
||||
Reference in New Issue
Block a user