Skip to content

Commit 571e0e5

Browse files
authored
Merge pull request #1545 from rust-lang/site-template-convert-3
Convert graphs page to templates
2 parents 25ea907 + 15f2eff commit 571e0e5

File tree

4 files changed

+466
-470
lines changed

4 files changed

+466
-470
lines changed

site/src/server.rs

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -598,16 +598,21 @@ async fn handle_fs_path(req: &Request, path: &str) -> Option<http::Response<hype
598598
}
599599
}
600600

601+
async fn render_page(path: &str) -> Vec<u8> {
602+
TEMPLATES
603+
.render(&format!("pages/{}", path))
604+
.await
605+
.unwrap()
606+
.into_bytes()
607+
}
608+
601609
let source = match path {
610+
"/index.html" => render_page("graphs.html").await,
602611
"/bootstrap.html"
603612
| "/dashboard.html"
604613
| "/detailed-query.html"
605614
| "/help.html"
606-
| "/status.html" => TEMPLATES
607-
.render(&format!("pages/{}", path.trim_start_matches("/")))
608-
.await
609-
.unwrap()
610-
.into_bytes(),
615+
| "/status.html" => render_page(path.trim_start_matches("/")).await,
611616
_ => {
612617
if !Path::new(&fs_path).is_file() {
613618
return None;

0 commit comments

Comments
 (0)