feat: log title show container name, closes #16
This commit is contained in:
+11
-2
@@ -253,11 +253,20 @@ impl AppData {
|
||||
}
|
||||
|
||||
/// Get the title for log panel for selected container
|
||||
/// will be "logs x/x"
|
||||
/// will be either
|
||||
/// 1) "logs x/x - container_name" where container_name is 32 chars max
|
||||
/// 2) "logs - container_name" when no logs found, again 32 chars max
|
||||
pub fn get_log_title(&self) -> String {
|
||||
self.get_selected_log_index()
|
||||
.map_or("".to_owned(), |index| {
|
||||
self.containers.items[index].logs.get_state_title()
|
||||
let logs_len = self.containers.items[index].logs.get_state_title();
|
||||
let mut name = self.containers.items[index].name.clone();
|
||||
name.truncate(32);
|
||||
if logs_len.is_empty() {
|
||||
format!("- {} ", name)
|
||||
} else {
|
||||
format!("{} - {}", logs_len, name)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user