Implemented full system browsing support with logs, events, and tasks.

This commit is contained in:
2023-08-08 10:50:06 -06:00
parent 460efb2497
commit b2e475200c
25 changed files with 1209 additions and 233 deletions
+6
View File
@@ -174,6 +174,12 @@ impl From<String> for HorizontallyScrollableText {
}
}
impl From<&str> for HorizontallyScrollableText {
fn from(text: &str) -> HorizontallyScrollableText {
HorizontallyScrollableText::new(text.to_owned())
}
}
impl Display for HorizontallyScrollableText {
fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
if *self.offset.borrow() == 0 {
+19 -10
View File
@@ -158,7 +158,7 @@ mod tests {
}
#[test]
fn test_horizontally_scrollable_text_from() {
fn test_horizontally_scrollable_text_from_string() {
let test_text = "Test string";
let horizontally_scrollable_text = HorizontallyScrollableText::from(test_text.to_owned());
@@ -166,10 +166,19 @@ mod tests {
assert_str_eq!(horizontally_scrollable_text.text, test_text);
}
#[test]
fn test_horizontally_scrollable_text_from_str() {
let test_text = "Test string";
let horizontally_scrollable_text = HorizontallyScrollableText::from(test_text);
assert_eq!(*horizontally_scrollable_text.offset.borrow(), 0);
assert_str_eq!(horizontally_scrollable_text.text, test_text);
}
#[test]
fn test_horizontally_scrollable_text_to_string() {
let test_text = "Test string";
let horizontally_scrollable_text = HorizontallyScrollableText::from(test_text.to_owned());
let horizontally_scrollable_text = HorizontallyScrollableText::from(test_text);
assert_str_eq!(horizontally_scrollable_text.to_string(), test_text);
@@ -199,7 +208,7 @@ mod tests {
#[test]
fn test_horizontally_scrollable_text_scroll_text_left() {
let horizontally_scrollable_text = HorizontallyScrollableText::from("Test string".to_owned());
let horizontally_scrollable_text = HorizontallyScrollableText::from("Test string");
assert_eq!(*horizontally_scrollable_text.offset.borrow(), 0);
@@ -219,7 +228,7 @@ mod tests {
#[test]
fn test_horizontally_scrollable_text_scroll_text_right() {
let horizontally_scrollable_text = HorizontallyScrollableText::from("Test string".to_owned());
let horizontally_scrollable_text = HorizontallyScrollableText::from("Test string");
*horizontally_scrollable_text.offset.borrow_mut() = horizontally_scrollable_text.text.len();
for i in 1..horizontally_scrollable_text.text.len() {
@@ -238,7 +247,7 @@ mod tests {
#[test]
fn test_horizontally_scrollable_text_scroll_home() {
let horizontally_scrollable_text = HorizontallyScrollableText::from("Test string".to_owned());
let horizontally_scrollable_text = HorizontallyScrollableText::from("Test string");
horizontally_scrollable_text.scroll_home();
@@ -264,7 +273,7 @@ mod tests {
fn test_horizontally_scrollable_text_scroll_or_reset() {
let width = 3;
let test_text = "Test string";
let horizontally_scrollable_text = HorizontallyScrollableText::from(test_text.to_owned());
let horizontally_scrollable_text = HorizontallyScrollableText::from(test_text);
horizontally_scrollable_text.scroll_left_or_reset(width, true, true);
@@ -289,7 +298,7 @@ mod tests {
#[test]
fn test_horizontally_scrollable_test_scroll_or_reset_resets_when_text_unselected() {
let horizontally_scrollable_test = HorizontallyScrollableText::from("Test string".to_owned());
let horizontally_scrollable_test = HorizontallyScrollableText::from("Test string");
horizontally_scrollable_test.scroll_left();
assert_eq!(*horizontally_scrollable_test.offset.borrow(), 1);
@@ -302,7 +311,7 @@ mod tests {
#[test]
fn test_horizontally_scrollable_text_drain() {
let test_text = "Test string";
let mut horizontally_scrollable_text = HorizontallyScrollableText::from(test_text.to_owned());
let mut horizontally_scrollable_text = HorizontallyScrollableText::from(test_text);
assert_str_eq!(horizontally_scrollable_text.drain(), test_text);
assert!(horizontally_scrollable_text.text.is_empty());
@@ -312,7 +321,7 @@ mod tests {
#[test]
fn test_horizontally_scrollable_text_pop() {
let test_text = "Test string";
let mut horizontally_scrollable_text = HorizontallyScrollableText::from(test_text.to_owned());
let mut horizontally_scrollable_text = HorizontallyScrollableText::from(test_text);
horizontally_scrollable_text.pop();
assert_str_eq!(horizontally_scrollable_text.text, "Test strin");
@@ -341,7 +350,7 @@ mod tests {
#[test]
fn test_horizontally_scrollable_text_push() {
let test_text = "Test string";
let mut horizontally_scrollable_text = HorizontallyScrollableText::from(test_text.to_owned());
let mut horizontally_scrollable_text = HorizontallyScrollableText::from(test_text);
horizontally_scrollable_text.push('h');
assert_str_eq!(horizontally_scrollable_text.text, "Test stringh");
+3 -3
View File
@@ -414,7 +414,7 @@ pub struct Log {
pub time: DateTime<Utc>,
pub exception: Option<String>,
pub exception_type: Option<String>,
pub level: Option<String>,
pub level: String,
pub logger: Option<String>,
pub message: Option<String>,
pub method: Option<String>,
@@ -440,7 +440,7 @@ pub struct Task {
#[derive(Default, Deserialize, Debug, Clone, PartialEq, Eq)]
#[serde(rename_all = "camelCase")]
pub struct Event {
pub struct QueueEvent {
pub trigger: String,
pub name: String,
pub command_name: String,
@@ -448,5 +448,5 @@ pub struct Event {
pub queued: DateTime<Utc>,
pub started: Option<DateTime<Utc>>,
pub ended: Option<DateTime<Utc>>,
pub duration: String,
pub duration: Option<String>,
}