Skip to content

Commit

Permalink
Fix table update in-place (#422)
Browse files Browse the repository at this point in the history
Before this fix, on narrow terminals the table printed by ank apply has
not been updated in-place. Instead it has been repeated below the
previous table. The reason for that has been the warning output which
disturbed the logic of keeping the old table and replacing that in
log.rs:104 fn output_update_fn().

Issue-Id: #420
  • Loading branch information
windsource authored Dec 17, 2024
1 parent 740e6dd commit cf73e93
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 16 deletions.
9 changes: 1 addition & 8 deletions ank/src/cli_commands/get_workloads.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
// under the License.
//
// SPDX-License-Identifier: Apache-2.0
use crate::output_warn;
use crate::{cli_error::CliError, output_debug};

use super::cli_table::CliTable;
Expand Down Expand Up @@ -65,13 +64,7 @@ impl CliCommands {
.table_with_wrapped_column_to_remaining_terminal_width(
WorkloadTableRow::ADDITIONAL_INFO_POS,
)
.unwrap_or_else(|err| {
output_warn!(
"Could not create wrapped table: '{}'. Continue with default table.",
err
);
CliTable::new(&table_rows).create_default_table()
}))
.unwrap_or_else(|_err| CliTable::new(&table_rows).create_default_table()))
}
}

Expand Down
10 changes: 2 additions & 8 deletions ank/src/cli_commands/wait_list_display.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ use std::{

use common::objects::WorkloadInstanceName;

use crate::{cli_commands::workload_table_row::WorkloadTableRowWithSpinner, output_warn};
use crate::cli_commands::workload_table_row::WorkloadTableRowWithSpinner;

use super::cli_table::CliTable;
use super::{wait_list::WaitListDisplayTrait, workload_table_row::WorkloadTableRow};
Expand Down Expand Up @@ -58,13 +58,7 @@ impl Display for WaitListDisplay {
.table_with_truncated_column_to_remaining_terminal_width(
WorkloadTableRowWithSpinner::ADDITIONAL_INFO_POS,
)
.unwrap_or_else(|err| {
output_warn!(
"Could not create truncated table: '{}'. Continue with default table.",
err
);
CliTable::new(&table_rows_with_spinner).create_default_table()
});
.unwrap_or_else(|_err| CliTable::new(&table_rows_with_spinner).create_default_table());

write!(f, "{}", table)
}
Expand Down

0 comments on commit cf73e93

Please sign in to comment.