Skip to content

Commit

Permalink
Merge pull request #2375 from mazzi/chore_upgrade_ratatui
Browse files Browse the repository at this point in the history
chore(launchpad): update ratatui and throbbber versions
  • Loading branch information
mazzi authored Nov 4, 2024
2 parents 7196590 + de56794 commit e3d1145
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 27 deletions.
36 changes: 24 additions & 12 deletions Cargo.lock

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

4 changes: 2 additions & 2 deletions node-launchpad/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ libc = "0.2.148"
log = "0.4.20"
pretty_assertions = "1.4.0"
prometheus-parse = "0.2.5"
ratatui = { version = "0.28.1", features = ["serde", "macros", "unstable-widget-ref"] }
ratatui = { version = "0.29.0", features = ["serde", "macros", "unstable-widget-ref"] }
reqwest = { version = "0.12.2", default-features = false, features = [
"rustls-tls-manual-roots",
] }
Expand All @@ -69,7 +69,7 @@ tracing-subscriber = { version = "0.3.17", features = ["env-filter", "serde"] }
tui-input = "0.8.0"
which = "6.0.1"
faccess = "0.2.4"
throbber-widgets-tui = "0.7.0"
throbber-widgets-tui = "0.8.0"
regex = "1.11.0"
arboard = "3.4.1"

Expand Down
16 changes: 3 additions & 13 deletions node-launchpad/src/components/status.rs
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ impl Status<'_> {
// Update status based on current node status
item.status = match node_item.status {
ServiceStatus::Running => {
NodeItem::update_spinner_state(&mut item.spinner_state);
item.spinner_state.calc_next();
NodeStatus::Running
}
ServiceStatus::Stopped => NodeStatus::Stopped,
Expand All @@ -190,7 +190,7 @@ impl Status<'_> {

// Starting is not part of ServiceStatus so we do it manually
if let Some(LockRegistryState::StartingNodes) = self.lock_registry {
NodeItem::update_spinner_state(&mut item.spinner_state);
item.spinner_state.calc_next();
if item.status != NodeStatus::Running {
item.status = NodeStatus::Starting;
}
Expand Down Expand Up @@ -850,7 +850,7 @@ impl Component for Status<'_> {
let table = Table::new(items, node_widths)
.header(header_row)
.column_spacing(1)
.highlight_style(Style::default().bg(INDIGO))
.row_highlight_style(Style::default().bg(INDIGO))
.highlight_spacing(HighlightSpacing::Always);

f.render_widget(table, inner_area);
Expand Down Expand Up @@ -1059,16 +1059,6 @@ pub struct NodeItem<'a> {
}

impl NodeItem<'_> {
fn update_spinner_state(state: &mut ThrobberState) {
// Call calc_next on the spinner state
// https://github.com/arkbig/throbber-widgets-tui/issues/19
if state.index() == i8::MAX {
*state = ThrobberState::default();
} else {
state.calc_next();
}
}

fn render_as_row(&mut self, index: usize, area: Rect, f: &mut Frame<'_>) -> Row {
let mut row_style = Style::default().fg(GHOST_WHITE);
let mut spinner_state = self.spinner_state.clone();
Expand Down

0 comments on commit e3d1145

Please sign in to comment.