Skip to content

Commit

Permalink
stuff compiles and kinda works
Browse files Browse the repository at this point in the history
  • Loading branch information
DolceTriade committed Jan 14, 2025
1 parent 9e22eb1 commit 3c03db1
Show file tree
Hide file tree
Showing 13 changed files with 160 additions and 108 deletions.
4 changes: 2 additions & 2 deletions .bazel-lib/bazelrc/clippy.bazelrc
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
build --aspects=@rules_rust//rust:defs.bzl%rust_clippy_aspect
build --output_groups=+clippy_checks
#build --aspects=@rules_rust//rust:defs.bzl%rust_clippy_aspect
#build --output_groups=+clippy_checks#
build --output_groups=+default
build --show_result=0
# Nix passes this in for us?
Expand Down
10 changes: 8 additions & 2 deletions blade/components/shellout.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,16 @@ pub fn ShellOut(#[prop(into)] text: Signal<String>) -> impl IntoView {
}
});
view! {
<div node_ref=nr class="bg-gray-800 text-white p-4 rounded-lg overflow-auto overflow-x-auto">
<div
node_ref=nr
class="bg-gray-800 text-white p-4 rounded-lg overflow-auto overflow-x-auto"
>
{move || match ansi_to_html::convert_escaped(&text.read()) {
Err(err) => view! { <div>{format!("mistake: {:#?}", err)}</div> }.into_any(),
Ok(t) => view! { <div class="inline whitespace-pre font-mono" inner_html=t></div> }.into_any(),
Ok(t) => {
view! { <div class="inline whitespace-pre font-mono" inner_html=t></div> }
.into_any()
}
}}

</div>
Expand Down
4 changes: 3 additions & 1 deletion blade/components/summaryheader.rs
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,9 @@ pub fn SummaryHeader() -> impl IntoView {
<span class="text-lg">
<b>{cmd}</b>
</span>
<span class="inline-flex max-w-1/2 overflow-auto whitespace-nowrap">{patterns}</span>
<span class="inline-flex max-w-1/2 overflow-auto whitespace-nowrap">
{patterns}
</span>
<span>@</span>
<span class="text-grey-400 text-sm">{start}</span>
</div>
Expand Down
5 changes: 3 additions & 2 deletions blade/components/targetlist.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ use crate::components::searchbar::Searchbar;
use crate::components::statusicon::StatusIcon;
use crate::components::tooltip::Tooltip;
use leptos::prelude::*;
use leptos_router::components::A;
use std::collections::HashMap;
use web_sys::KeyboardEvent;

Expand Down Expand Up @@ -97,7 +98,7 @@ pub fn TargetList() -> impl IntoView {
<ListItem hide=Signal::derive(move || {
!filter.get().is_empty() && !label.contains(&filter.get())
})>
<a href=link>
<A href=link>
<div class="flex items-center justify-start w-full">
<span class="float-left">
<StatusIcon
Expand All @@ -119,7 +120,7 @@ pub fn TargetList() -> impl IntoView {
{format!("{}", humantime::format_duration(t.duration))}
</span>
</div>
</a>
</A>
</ListItem>
}
}
Expand Down
54 changes: 28 additions & 26 deletions blade/components/testartifactlist.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
use leptos::prelude::*;
use leptos_router::components::A;

use crate::components::list::*;

Expand Down Expand Up @@ -55,36 +56,37 @@ pub fn TestArtifactList() -> impl IntoView {
<Suspense>
{move || Suspend::new(async move {
match manifest.await {
Some(outs) => {
view! {
<h1 class="font-bold text-lg">Undeclared Outputs</h1>
<List>
<For
each=move || outs.clone()
key=move |r: &UndeclaredOutput| r.name.clone()
children=move |r| {
let query = format!(
"../artifact?{}",
url_escape::encode_query(
&format!("uri={}&zip={}", r.uri, r.name),
),
);
view! {
<ListItem hide=Signal::derive(|| false)>
<a href=query>
{format!("{} -- ({} bytes)", r.name, r.size)}
</a>
</ListItem>
Some(outs) => {
view! {
<h1 class="font-bold text-lg">Undeclared Outputs</h1>
<List>
<For
each=move || outs.clone()
key=move |r: &UndeclaredOutput| r.name.clone()
children=move |r| {
let query = format!(
"../artifact?{}",
url_escape::encode_query(
&format!("uri={}&zip={}", r.uri, r.name),
),
);
view! {
<ListItem hide=Signal::derive(|| false)>
<A href=query>
{format!("{} -- ({} bytes)", r.name, r.size)}
</A>
</ListItem>
}
}
}
/>
/>

</List>
</List>
}
.into_any()
}
.into_any()
_ => view! { <div></div> }.into_any(),
}
_ => view!{<div/>}.into_any(),
}})}
})}

</Suspense>

Expand Down
2 changes: 1 addition & 1 deletion blade/components/testresults.rs
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ pub fn TestResults() -> impl IntoView {
}
.into_any()
}
_ => view!{<div/>}.into_any(),
_ => view! { <div></div> }.into_any(),
}}

</Suspense>
Expand Down
30 changes: 20 additions & 10 deletions blade/components/testrunlist.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
use leptos::prelude::*;
use web_sys::KeyboardEvent;
use leptos_router::hooks::use_location;
use leptos_router::components::A;

use crate::components::accordion::*;
use crate::components::list::*;
Expand Down Expand Up @@ -109,8 +110,8 @@ pub fn TestRunList() -> impl IntoView {
))
}

key={move |r| (r.run, r.shard, r.attempt)}
children={move |run| {
key=move |r| (r.run, r.shard, r.attempt)
children=move |run| {
let mut q = use_location().query.get();
let path = use_location().pathname;
let link = path
Expand All @@ -128,7 +129,7 @@ pub fn TestRunList() -> impl IntoView {
);
view! {
<ListItem hide=Signal::derive(|| false)>
<a href=link>
<A href=link>
<div class="flex items-center justify-start w-full">
<span class="float-left">
<StatusIcon
Expand Down Expand Up @@ -160,10 +161,10 @@ pub fn TestRunList() -> impl IntoView {
</span>

</div>
</a>
</A>
</ListItem>
}
}}
}
/>

</List>
Expand Down Expand Up @@ -214,11 +215,12 @@ pub fn TestRunList() -> impl IntoView {
&& !id.with(|id| id.contains(&filter.get()))
})>
<div
on:click={move |_| {
on:click=move |_| {
click(id.get());
}}
//TODO: Fix
//attr:test=move||id
}

// TODO: Fix
// attr:test=move||id
class="flex items-center justify-start w-full"
>
<span class="float-left">
Expand Down Expand Up @@ -251,7 +253,15 @@ pub fn TestRunList() -> impl IntoView {
}
.into_any()
}
_ => view! { <div>Loading...</div> }.into_any(),
_ => {
view! {
// TODO: Fix
// attr:test=move||id

<div>Loading...</div>
}
.into_any()
}
})
}}

Expand Down
11 changes: 6 additions & 5 deletions blade/components/testsummary.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
use leptos::prelude::*;
use leptos_router::*;
use leptos_router::components::A;

use crate::components::statusicon::StatusIcon;

Expand Down Expand Up @@ -94,15 +95,15 @@ fn RunSummary() -> impl IntoView {
}
.into_any()
})
.unwrap_or(view!{<div/>}.into_any())
.unwrap_or(view! { <div></div> }.into_any())
})
}}

</div>
}
.into_any()
})
.unwrap_or(view!{<div/>}.into_any())
.unwrap_or(view! { <div></div> }.into_any())
})
}}
}
Expand Down Expand Up @@ -132,7 +133,7 @@ where
.map(|test| {
view! {
<div class="w-screen h-fit grid grid-rows-1 grid-flow-col items-center justify-center p-2">
<a class="absolute float-left" href=move || link.get()>
<A attr:class="absolute float-left" href=move || link.get()>
<svg
xmlns="http://www.w3.org/2000/svg"
class="h-8 w-8"
Expand All @@ -143,7 +144,7 @@ where
<path d="M0 0h24v24H0z" fill="none"></path>
<path d="M20 11H7.83l5.59-5.59L12 4l-8 8 8 8 1.41-1.41L7.83 13H20v-2z"></path>
</svg>
</a>
</A>
<div>
<StatusIcon class="h-8 w-8" status=test.status.into()/>
</div>
Expand All @@ -160,7 +161,7 @@ where
}
.into_any()
})
.unwrap_or(view!{<div/>}.into_any())
.unwrap_or(view! { <div></div> }.into_any())
})
}}

Expand Down
3 changes: 1 addition & 2 deletions blade/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ pub mod routes;
// Needs to be in lib.rs AFAIK because wasm-bindgen needs us to be compiling a lib. I may be wrong.
cfg_if! {
if #[cfg(feature = "hydrate")] {
use leptos::mount::mount_to_body;
use wasm_bindgen::prelude::wasm_bindgen;
use tracing_web::{MakeWebConsoleWriter};
use tracing_subscriber::prelude::*;
Expand All @@ -23,7 +22,7 @@ cfg_if! {
tracing_subscriber::registry()
.with(fmt_layer)
.init();
mount_to_body(App);
leptos::mount::hydrate_body(App);
}
}
}
17 changes: 9 additions & 8 deletions blade/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,7 @@ cfg_if! {
let cleanup_state = state.clone();
tracing::info!("Starting blade server at: {}", addr.to_string());
let fut1 = HttpServer::new(move || {
let leptos_options = &conf.leptos_options;
let leptos_options = conf.leptos_options.clone();
let rt_state = actix_state.clone();
let routes = generate_route_list(App);
let app = App::new()
Expand All @@ -253,24 +253,25 @@ cfg_if! {
.leptos_routes_with_context(
routes,
move|| provide_context(rt_state.clone()),
move|| view! {
move|| {
view! {
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<AutoReload options=leptos_options.clone() />
<HydrationScripts options=leptos_options.clone()/>
<AutoReload options=leptos_options.to_owned() />
<HydrationScripts options=leptos_options.to_owned()/>
<MetaTags/>
</head>
<body>
<App/>
</body>
</html>
},
)
.app_data(web::Data::new(leptos_options.to_owned()))
.wrap(TracingLogger::<BladeRootSpanBuilder>::new())
}})
.app_data(web::Data::new(conf.leptos_options.to_owned()))
.wrap(TracingLogger::<BladeRootSpanBuilder>::new());
app
})
.disable_signals()
.bind(&addr)?
Expand Down
20 changes: 10 additions & 10 deletions blade/routes/app.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ use crate::routes::details::Details;
use crate::routes::invocation::Invocation;
use crate::routes::summary::Summary;
use crate::routes::test::Test;
use crate::routes::empty::Empty;
use leptos::prelude::*;
use leptos_meta::*;
use leptos_router::components::*;
Expand All @@ -27,16 +28,15 @@ pub fn App() -> impl IntoView {
<div id="root" class="h-screen w-screen max-h-screen max-w-screen overflow-hidden">
<Nav name="Blade" logo="/pkg/static/logo.svg"/>
<main>
<Routes fallback=|| "Not Found.">
<ParentRoute path=path!("invocation/:id") view=Invocation>
<Route path=path!("*any") view=Summary/>
<Route path=path!("test") view=Test/>
<Route path=path!("details") view=Details/>
<Route path=path!("artifact") view=Artifact/>
</ParentRoute>
// TODO: FIX
//<Route path=path!(path="*") view=Empty/>
</Routes>
<Routes fallback=|| "Not Found.">
<ParentRoute path=path!("invocation/:id") view=Invocation>
<Route path=path!("*any") view=Summary/>
<Route path=path!("test") view=Test/>
<Route path=path!("details") view=Details/>
<Route path=path!("artifact") view=Artifact/>
</ParentRoute>
<Route path=path!("*any") view=Empty/>
</Routes>
</main>
</div>
</Router>
Expand Down
19 changes: 11 additions & 8 deletions blade/routes/artifact.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,14 +43,17 @@ pub fn Artifact() -> impl IntoView {
);
view! {
<div class="h-[80vh] flex items-start justify-start justify-items-center overflow-auto overflow-x-auto">
<Suspense fallback=move || view! { <div>Loading...</div> }>
{move||Suspend::new(async move {
let t: String = match artifact.await {
Ok(t) => t.into(),
Err(t) => t.into(),
};
view!{ <ShellOut text={t} /> }
})}
<Suspense fallback=move || {
view! { <div>Loading...</div> }
}>
{move || Suspend::new(async move {
let t: String = match artifact.await {
Ok(t) => t.into(),
Err(t) => t.into(),
};
view! { <ShellOut text=t/> }
})}

</Suspense>
</div>
}
Expand Down
Loading

0 comments on commit 3c03db1

Please sign in to comment.