Skip to content

Commit

Permalink
fix: cargo fmt added to create_release
Browse files Browse the repository at this point in the history
  • Loading branch information
mrjackwills committed Apr 25, 2022
1 parent 3fb48ab commit bb29c0e
Show file tree
Hide file tree
Showing 7 changed files with 18 additions and 21 deletions.
1 change: 1 addition & 0 deletions create_release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,7 @@ release_flow() {
ask_changelog_update
git checkout -b "$RELEASE_BRANCH"
update_cargo_toml
cargo fmt
git add .
git commit -m "chore: release $NEW_TAG_VERSION"
git checkout main
Expand Down
4 changes: 2 additions & 2 deletions src/app_data/container_state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,7 @@ impl Stats for CpuStats {
impl fmt::Display for CpuStats {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
let disp = format!("{:05.2}%", self.value);
write!(f, "{:>x$}", disp, x = f.width().unwrap_or(1))
write!(f, "{:>x$}", disp, x = f.width().unwrap_or(1))
}
}

Expand Down Expand Up @@ -411,7 +411,7 @@ pub struct Columns {
impl Columns {
pub fn new() -> Self {
Self {
// 7 to allow for 100.00%
// 7 to allow for 100.00%
cpu: (String::from("cpu"), 7),
image: (String::from("image"), 5),
name: (String::from("name"), 4),
Expand Down
11 changes: 4 additions & 7 deletions src/app_data/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,16 +31,14 @@ impl AppData {
}
}


// Current time as unix timestamp
// Current time as unix timestamp
fn get_systemtime(&self) -> u64 {
SystemTime::now()
.duration_since(UNIX_EPOCH)
.expect("In our known reality, this error should never occur")
.as_secs()
}


/// Get the current select docker command
/// So know which command to execute
pub fn get_docker_command(&self) -> Option<DockerControls> {
Expand Down Expand Up @@ -363,8 +361,8 @@ impl AppData {
}
}

/// update logs of a given container, based on index not id
pub fn update_log_by_index(&mut self, output: Vec<String>, index: usize) {
/// update logs of a given container, based on index not id
pub fn update_log_by_index(&mut self, output: Vec<String>, index: usize) {
let tz = self.get_systemtime();
if let Some(container) = self.containers.items.get_mut(index) {
container.last_updated = tz;
Expand All @@ -388,8 +386,7 @@ impl AppData {
self.logs_parsed = true;
}


pub fn update_all_logs(&mut self, all_logs: Vec<Vec<String>>) {
pub fn update_all_logs(&mut self, all_logs: Vec<Vec<String>>) {
for (index, output) in all_logs.into_iter().enumerate() {
self.update_log_by_index(output, index);
}
Expand Down
4 changes: 2 additions & 2 deletions src/input_handler/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ impl InputHandler {
is_running,
rec,
};
inner.start().await;
inner.start().await;
}

/// check for incoming messages
Expand Down Expand Up @@ -129,7 +129,7 @@ impl InputHandler {
}
}
KeyCode::Enter => {
// Does is matter though?
// Does is matter though?
// This isn't great, just means you can't send docker commands before full initialization of the program
// could change to to if loading = true, although at the moment don't have a loading bool
let panel = self.gui_state.lock().selected_panel;
Expand Down
11 changes: 5 additions & 6 deletions src/ui/draw_blocks.rs
Original file line number Diff line number Diff line change
Expand Up @@ -222,16 +222,15 @@ pub fn draw_logs<B: Backend>(

let block = generate_block(Some(panel), app_data, selected_panel);

let init = app_data.lock().init;
if !init {
let icon = gui_state.lock().get_loading();
let init = app_data.lock().init;
if !init {
let icon = gui_state.lock().get_loading();
let parsing_logs = format!("parsing logs {}", icon);
let paragraph = Paragraph::new(parsing_logs)
.style(Style::default())
.block(block)
.alignment(Alignment::Center);
f.render_widget(paragraph, area)

} else if let Some(index) = index {
let items = app_data.lock().containers.items[index]
.logs
Expand Down Expand Up @@ -349,8 +348,8 @@ fn make_chart<T: Stats + Display>(
.fg(label_color),
),
])
// add 0.01, for cases when the value is 0
.bounds([0.0, max.get_value() +0.01]),
// add 0.01, for cases when the value is 0
.bounds([0.0, max.get_value() + 0.01]),
)
}

Expand Down
6 changes: 3 additions & 3 deletions src/ui/gui_state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -94,9 +94,9 @@ impl SelectablePanel {
/// Global gui_state, stored in an Arc<Mutex>
#[derive(Debug)]
pub struct GuiState {
// Think this should be a BMapTree, so can define order when iterating over potential intersects
// Is an issue if two panels are in the same space, sush as a smaller panel embedded, yet infront of, a larger panel
// If a BMapTree think it would mean have to implement ordering for SelectablePanel
// Think this should be a BMapTree, so can define order when iterating over potential intersects
// Is an issue if two panels are in the same space, sush as a smaller panel embedded, yet infront of, a larger panel
// If a BMapTree think it would mean have to implement ordering for SelectablePanel
area_map: HashMap<SelectablePanel, Rect>,
loading: Loading,
pub selected_panel: SelectablePanel,
Expand Down
2 changes: 1 addition & 1 deletion src/ui/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ async fn run_app<B: Backend>(
} else {
loop {
terminal.draw(|f| ui(f, &app_data, &gui_state)).unwrap();
if crossterm::event::poll(input_poll_rate).unwrap() {
if crossterm::event::poll(input_poll_rate).unwrap() {
let event = event::read().unwrap();
if let Event::Key(key) = event {
sender
Expand Down

0 comments on commit bb29c0e

Please sign in to comment.