feat: set log timezone, closes #56

Implement a CLI arg, and config file setting, for changing the timezone of the Docker logs timestamp
This commit is contained in:
Jack Wills
2025-02-21 11:03:19 +00:00
parent 8305e6fda6
commit 17a5e7a258
27 changed files with 1122 additions and 163 deletions
+24 -19
View File
@@ -16,11 +16,11 @@ use super::popup;
/// Draw an error popup over whole screen
pub fn draw(
f: &mut Frame,
colors: AppColors,
error: &AppError,
f: &mut Frame,
keymap: &Keymap,
seconds: Option<u8>,
colors: AppColors,
) {
let block = Block::default()
.title(" Error ")
@@ -106,16 +106,20 @@ mod tests {
#[test]
/// Test that the error popup is centered, red background, white border, white text, and displays the correct text
fn test_draw_blocks_docker_connect_error() {
fn test_draw_blocks_error_docker_connect_error() {
let (w, h) = (46, 9);
let mut setup = test_setup(w, h, true, true);
let app_colors = setup.app_data.lock().config.app_colors;
let keymap = &setup.app_data.lock().config.keymap;
setup
.terminal
.draw(|f| {
super::draw(f, &AppError::DockerConnect, keymap, Some(4), app_colors);
super::draw(
AppColors::new(),
&AppError::DockerConnect,
f,
&Keymap::new(),
Some(4),
);
})
.unwrap();
@@ -153,17 +157,20 @@ mod tests {
#[test]
/// Test that the clearable error popup is centered, red background, white border, white text, and displays the correct text
fn test_draw_blocks_clearable_error() {
fn test_draw_blocks_error_clearable_error() {
let (w, h) = (39, 11);
let mut setup = test_setup(w, h, true, true);
let app_colors = setup.app_data.lock().config.app_colors;
let keymap = &setup.app_data.lock().config.keymap;
setup
.terminal
.draw(|f| {
super::draw(f, &AppError::DockerExec, keymap, Some(4), app_colors);
super::draw(
AppColors::new(),
&AppError::DockerExec,
f,
&Keymap::new(),
Some(4),
);
})
.unwrap();
@@ -203,12 +210,10 @@ mod tests {
#[test]
/// Custom colors applied to the error popup correctly
fn test_draw_blocks_clearable_error_custom_colors() {
fn test_draw_blocks_error_custom_colors() {
let (w, h) = (39, 11);
let mut setup = test_setup(w, h, true, true);
let keymap = &setup.app_data.lock().config.keymap;
let mut colors = AppColors::new();
colors.popup_error.background = Color::Yellow;
colors.popup_error.text = Color::Black;
@@ -216,7 +221,7 @@ mod tests {
setup
.terminal
.draw(|f| {
super::draw(f, &AppError::DockerExec, keymap, Some(4), colors);
super::draw(colors, &AppError::DockerExec, f, &Keymap::new(), Some(4));
})
.unwrap();
@@ -256,7 +261,7 @@ mod tests {
#[test]
/// Custom keymap applied correct with both 1 and 2 definitions
fn test_draw_blocks_clearable_error_custom_keymap() {
fn test_draw_blocks_error_custom_keymap() {
let (w, h) = (39, 11);
let mut setup = test_setup(w, h, true, true);
@@ -267,7 +272,7 @@ mod tests {
setup
.terminal
.draw(|f| {
super::draw(f, &AppError::DockerExec, &keymap, None, AppColors::new());
super::draw(AppColors::new(), &AppError::DockerExec, f, &keymap, None);
})
.unwrap();
@@ -299,7 +304,7 @@ mod tests {
setup
.terminal
.draw(|f| {
super::draw(f, &AppError::DockerExec, &keymap, None, AppColors::new());
super::draw(AppColors::new(), &AppError::DockerExec, f, &keymap, None);
})
.unwrap();
@@ -330,7 +335,7 @@ mod tests {
setup
.terminal
.draw(|f| {
super::draw(f, &AppError::DockerExec, &keymap, None, AppColors::new());
super::draw(AppColors::new(), &AppError::DockerExec, f, &keymap, None);
})
.unwrap();