inverse the logs queue, ascending order for events
Signed-off-by: Uncle Stretch <uncle.stretch@ghostchain.io>
This commit is contained in:
parent
9704af3978
commit
10a9ca166c
@ -39,18 +39,15 @@ impl EventLogs {
|
|||||||
const MAX_LOGS: usize = 50;
|
const MAX_LOGS: usize = 50;
|
||||||
|
|
||||||
fn add_new_log(&mut self, message: String, level: ActionLevel) {
|
fn add_new_log(&mut self, message: String, level: ActionLevel) {
|
||||||
self.logs.push_back(WalletLog {
|
self.logs.push_front(WalletLog {
|
||||||
time: chrono::Local::now(),
|
time: chrono::Local::now(),
|
||||||
level,
|
level,
|
||||||
message,
|
message,
|
||||||
});
|
});
|
||||||
|
|
||||||
if self.logs.len() > Self::MAX_LOGS {
|
if self.logs.len() > Self::MAX_LOGS {
|
||||||
let _ = self.logs.pop_front();
|
let _ = self.logs.pop_back();
|
||||||
}
|
}
|
||||||
|
|
||||||
self.table_state.select(Some(self.logs.len() - 1));
|
|
||||||
self.scroll_state = self.scroll_state.content_length(self.logs.len());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fn first_row(&mut self) {
|
fn first_row(&mut self) {
|
||||||
|
Loading…
Reference in New Issue
Block a user