-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Alex
committed
Dec 30, 2023
1 parent
ccc8d73
commit d057692
Showing
9 changed files
with
1,270 additions
and
56 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,11 @@ | ||
[[monitors]] | ||
title = "Shuttle" | ||
url = "https://shuttle.rs" | ||
method = "GET" | ||
check_interval = 30000 | ||
|
||
[[monitors]] | ||
title = "Rust" | ||
url = "https://www.rust-lang.org" | ||
method = "GET" | ||
check_interval = 30000 |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
use std::collections::HashMap; | ||
|
||
use leptos::*; | ||
use leptos_meta::*; | ||
use leptos_router::*; | ||
|
||
use crate::{AppState, MonitorResult, UrlConfig}; | ||
use thaw::*; | ||
|
||
#[component] | ||
pub fn App(app_state: AppState) -> impl IntoView { | ||
// Provides context that manages stylesheets, titles, meta tags, etc. | ||
provide_meta_context(); | ||
|
||
view! { | ||
<Stylesheet id="leptos" href="/pkg/ssr_modes.css"/> | ||
<Title text="Welcome to Leptos"/> | ||
|
||
<Router> | ||
<main> | ||
<Routes> | ||
<Route path="" view=move || view! { | ||
<HomePage results=app_state | ||
.get_results() | ||
/> | ||
}/> | ||
</Routes> | ||
</main> | ||
</Router> | ||
} | ||
} | ||
|
||
#[component] | ||
fn HomePage(results: HashMap<UrlConfig, Vec<MonitorResult>>) -> impl IntoView { | ||
view! { | ||
<h1>"Pingy!"</h1> | ||
|
||
<Table> | ||
<thead> | ||
<tr> | ||
<th>"Title"</th> | ||
<th>"URL"</th> | ||
<th>"Status Code"</th> | ||
<th>"Latency (ms)"</th> | ||
</tr> | ||
</thead> | ||
<tbody> | ||
{results.into_iter() | ||
.map(|n| view! { | ||
<tr> | ||
<td>{n.0.title.to_string()}</td> | ||
<td>{n.0.url.to_string()}</td> | ||
<td>{n.1.iter().last().unwrap().status_code}</td> | ||
<td>{n.1.iter().last().unwrap().latency}</td> | ||
</tr> | ||
}) | ||
.collect::<Vec<_>>()} | ||
</tbody> | ||
</Table> | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.