Properly render the agent name

This render_compact work is still half-finished, but I'm focused elsewhere at
the moment and will come back to the idea of view components later
This commit is contained in:
R Tyler Croy 2023-03-12 17:21:16 -07:00
parent 6cc263aae4
commit c709b8042f
3 changed files with 5 additions and 3 deletions

View File

@ -57,7 +57,7 @@ impl Agent {
} }
pub fn render_compact(&self, _state: &AppState<'_>) -> String { pub fn render_compact(&self, _state: &AppState<'_>) -> String {
"".into() self.name.clone()
//let data = serde_json::to_str(self).unwrap_or(serde_json::Value::Array); //let data = serde_json::to_str(self).unwrap_or(serde_json::Value::Array);
//state.render("views/components/agent/compact.hbs", //state.render("views/components/agent/compact.hbs",

View File

@ -117,7 +117,7 @@ async fn main() -> Result<(), tide::Error> {
} }
for (name, agent) in config.agents.iter() { for (name, agent) in config.agents.iter() {
debug!("Requesting capabilities from agent: {:?}", agent); debug!("Requesting capabilities from agent: {} {:?}", name, agent);
let response: synchronik::CapsResponse = let response: synchronik::CapsResponse =
reqwest::get(agent.url.join("/api/v1/capabilities")?) reqwest::get(agent.url.join("/api/v1/capabilities")?)
.await? .await?

View File

@ -4,9 +4,10 @@
* *
* Modules are nested for cleaner organization here * Modules are nested for cleaner organization here
*/ */
use crate::AppState; use log::*;
use tide::{Body, Request}; use tide::{Body, Request};
use crate::AppState;
use crate::models::Project; use crate::models::Project;
/** /**
@ -26,6 +27,7 @@ pub async fn index(req: Request<AppState<'_>>) -> Result<Body, tide::Error> {
"projects" : Project::list(&req.state().db).await?, "projects" : Project::list(&req.state().db).await?,
}); });
debug!("Rendering home page with: {:?}", params);
let mut body = req.state().render("index", &params).await?; let mut body = req.state().render("index", &params).await?;
body.set_mime("text/html"); body.set_mime("text/html");
Ok(body) Ok(body)