Format webui

This commit is contained in:
Austen Adler 2021-08-22 12:11:42 -04:00
parent d13432e35d
commit 690aaf4d40

View File

@ -75,7 +75,7 @@ async fn initial_load(data: web::Data<AppState>, _req: HttpRequest) -> impl Resp
let state = AppTemplate { let state = AppTemplate {
body: ControlTemplate { body: ControlTemplate {
strip_tx: Some(data.strip_tx.clone()), strip_tx: Some(data.strip_tx.clone()),
..ControlTemplate::default() ..ControlTemplate::default()
} }
.render() .render()
.map_err(|e| { .map_err(|e| {
@ -136,12 +136,26 @@ async fn start_socket(
state.parameters = p; state.parameters = p;
state.strip_tx.as_ref()? state
.strip_tx
.as_ref()?
.lock() .lock()
.map_err(|_| println!("{:?}", io::Error::new(io::ErrorKind::Other, "Failed to get a lock"))) .map_err(|_| {
println!(
"{:?}",
io::Error::new(io::ErrorKind::Other, "Failed to get a lock")
)
})
.ok()? .ok()?
.send(strip::Message::ChangePattern(state.parameters.into_pattern())) .send(strip::Message::ChangePattern(
.map_err(|_| println!("{:?}", io::Error::new(io::ErrorKind::Other, "Failed to send to channel"))) state.parameters.into_pattern(),
))
.map_err(|_| {
println!(
"{:?}",
io::Error::new(io::ErrorKind::Other, "Failed to send to channel")
)
})
.ok()?; .ok()?;
} }
@ -150,7 +164,7 @@ async fn start_socket(
let actor = StateSocket { let actor = StateSocket {
state: ControlTemplate { state: ControlTemplate {
strip_tx: Some(data.strip_tx.clone()), strip_tx: Some(data.strip_tx.clone()),
..ControlTemplate::default() ..ControlTemplate::default()
}, },
live_view, live_view,
}; };