Compare commits
2 Commits
ac66404055
...
b3e761c83d
| Author | SHA1 | Date | |
|---|---|---|---|
|
b3e761c83d
|
|||
|
840e8ee6e0
|
@@ -2,7 +2,7 @@ use crate::components::{select::*, skeleton::*};
|
|||||||
use crate::loader::Loader;
|
use crate::loader::Loader;
|
||||||
use csv::{ReaderBuilder, StringRecord};
|
use csv::{ReaderBuilder, StringRecord};
|
||||||
use dioxus::prelude::*;
|
use dioxus::prelude::*;
|
||||||
use dioxus_primitives::toast::{use_toast, ToastOptions};
|
use dioxus_primitives::toast::{ToastOptions, use_toast};
|
||||||
use dioxus_sdk_time::*;
|
use dioxus_sdk_time::*;
|
||||||
use std::collections::HashMap;
|
use std::collections::HashMap;
|
||||||
use std::f32::consts::PI;
|
use std::f32::consts::PI;
|
||||||
@@ -210,7 +210,7 @@ pub fn Landing() -> Element {
|
|||||||
use_effect(move || match &*resource.read() {
|
use_effect(move || match &*resource.read() {
|
||||||
Ok(results) => {
|
Ok(results) => {
|
||||||
let mut reader = ReaderBuilder::new().from_reader(results.as_bytes());
|
let mut reader = ReaderBuilder::new().from_reader(results.as_bytes());
|
||||||
let records = match reader
|
let mut records = match reader
|
||||||
.into_records()
|
.into_records()
|
||||||
.collect::<Result<Vec<StringRecord>, csv::Error>>()
|
.collect::<Result<Vec<StringRecord>, csv::Error>>()
|
||||||
{
|
{
|
||||||
@@ -224,6 +224,7 @@ pub fn Landing() -> Element {
|
|||||||
Vec::new()
|
Vec::new()
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
records.retain(|record| TestStatus::from_str(&record[1]).is_ok());
|
||||||
result.set(records);
|
result.set(records);
|
||||||
toast.success(
|
toast.success(
|
||||||
"Success".to_string(),
|
"Success".to_string(),
|
||||||
@@ -326,10 +327,11 @@ pub fn Landing() -> Element {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if let Some(wanted) = f {
|
|
||||||
let Ok(status) = TestStatus::from_str(&r[1]) else {
|
let Ok(status) = TestStatus::from_str(&r[1]) else {
|
||||||
continue;
|
continue;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
if let Some(wanted) = f {
|
||||||
if status != wanted {
|
if status != wanted {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@@ -466,6 +468,7 @@ pub fn Landing() -> Element {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
for test in page.iter() {
|
for test in page.iter() {
|
||||||
|
if let Ok(status) = TestStatus::from_str(&test[1]) {
|
||||||
tr { class: "text-sm hover:bg-[#38bef7]/5",
|
tr { class: "text-sm hover:bg-[#38bef7]/5",
|
||||||
td { class: "py-2 px-3", "{&test[0]}" }
|
td { class: "py-2 px-3", "{&test[0]}" }
|
||||||
td { class: "py-2 px-3",
|
td { class: "py-2 px-3",
|
||||||
@@ -479,10 +482,8 @@ pub fn Landing() -> Element {
|
|||||||
}
|
}
|
||||||
td { class: "py-2 px-3",
|
td { class: "py-2 px-3",
|
||||||
StatusBadge {
|
StatusBadge {
|
||||||
status: match TestStatus::from_str(&test[1]) {
|
status
|
||||||
Ok(s) => Some(s),
|
}
|
||||||
_ => None,
|
|
||||||
},
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -532,27 +533,21 @@ fn StatCard(name: String, color: String, count: usize, stat: f32) -> Element {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[component]
|
#[component]
|
||||||
fn StatusBadge(status: Option<TestStatus>) -> Element {
|
fn StatusBadge(status: TestStatus) -> Element {
|
||||||
let color = match status {
|
|
||||||
Some(s) => s.color(),
|
|
||||||
None => "#FFF",
|
|
||||||
};
|
|
||||||
let name = match status {
|
|
||||||
Some(s) => s.to_string(),
|
|
||||||
None => "Unrecognized".to_string(),
|
|
||||||
};
|
|
||||||
|
|
||||||
rsx! {
|
rsx! {
|
||||||
div {
|
div {
|
||||||
class: "mx-auto border-1 py-1 px-3 rounded-3xl text-xs w-fit select-none",
|
class: "mx-auto border-1 py-1 px-3 rounded-3xl text-xs w-fit select-none",
|
||||||
style: format!(
|
style: format!(
|
||||||
r#"
|
r#"
|
||||||
background-color: {color}0F;
|
background-color: {}0F;
|
||||||
color: {color};
|
color: {};
|
||||||
border-color: {color};
|
border-color: {};
|
||||||
"#,
|
"#,
|
||||||
|
status.color(),
|
||||||
|
status.color(),
|
||||||
|
status.color(),
|
||||||
),
|
),
|
||||||
"{name}"
|
"{status.to_string()}"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user