fix: deadlock on draw logs when no containers found
This commit is contained in:
+13
-8
@@ -227,19 +227,24 @@ pub fn logs<B: Backend>(
|
|||||||
.alignment(Alignment::Center);
|
.alignment(Alignment::Center);
|
||||||
f.render_widget(paragraph, area);
|
f.render_widget(paragraph, area);
|
||||||
} else {
|
} else {
|
||||||
let items = app_data.lock().get_logs();
|
let logs = app_data.lock().get_logs();
|
||||||
let items = List::new(items)
|
|
||||||
.block(block())
|
|
||||||
.highlight_symbol(ARROW)
|
|
||||||
.highlight_style(Style::default().add_modifier(Modifier::BOLD));
|
|
||||||
|
|
||||||
if let Some(i) = app_data.lock().get_log_state() {
|
if logs.is_empty() {
|
||||||
f.render_stateful_widget(items, area, i);
|
|
||||||
} else {
|
|
||||||
let paragraph = Paragraph::new("no logs found")
|
let paragraph = Paragraph::new("no logs found")
|
||||||
.block(block())
|
.block(block())
|
||||||
.alignment(Alignment::Center);
|
.alignment(Alignment::Center);
|
||||||
f.render_widget(paragraph, area);
|
f.render_widget(paragraph, area);
|
||||||
|
} else {
|
||||||
|
let items = List::new(logs)
|
||||||
|
.block(block())
|
||||||
|
.highlight_symbol(ARROW)
|
||||||
|
.highlight_style(Style::default().add_modifier(Modifier::BOLD));
|
||||||
|
|
||||||
|
// This should always return Some, as logs is not empty
|
||||||
|
if let Some(i) = app_data.lock().get_log_state() {
|
||||||
|
f.render_stateful_widget(items, area, i);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user