checkpoint wip on components rendering
This commit is contained in:
parent
9506a78da9
commit
6d8e7d1b6b
|
@ -100,6 +100,14 @@ pub struct Agent {
|
|||
}
|
||||
|
||||
impl Agent {
|
||||
pub fn render_compact(&self, state: &AppState<'_>) -> String {
|
||||
"".into()
|
||||
//let data = serde_json::to_str(self).unwrap_or(serde_json::Value::Array);
|
||||
|
||||
//state.render("views/components/agent/compact.hbs",
|
||||
// data: data).await.unwrap_or("".into())
|
||||
}
|
||||
|
||||
pub fn can_meet(&self, needs: &Vec<String>) -> bool {
|
||||
// TODO: Improve the performance of this by reducing the clones
|
||||
let mut needs = needs.clone();
|
||||
|
|
|
@ -11,9 +11,12 @@ use tide::{Body, Request};
|
|||
* GET /
|
||||
*/
|
||||
pub async fn index(req: Request<AppState<'_>>) -> Result<Body, tide::Error> {
|
||||
let agents: Vec<String> = req.state().agents
|
||||
.iter()
|
||||
.map(|a| a.render_compact(req.state())).collect();
|
||||
let params = json!({
|
||||
"page": "home",
|
||||
"agents" : req.state().agents,
|
||||
"agents" : agents,
|
||||
"config" : req.state().config,
|
||||
"projects" : crate::dao::Project::list(&req.state().db).await?,
|
||||
});
|
||||
|
|
|
@ -0,0 +1,4 @@
|
|||
<span title="Capabilities: {{#each this.capabilities}}
|
||||
* {{this.name}} {{/each}}">
|
||||
{{this.name}}
|
||||
</span>
|
|
@ -20,10 +20,7 @@
|
|||
{{#each agents}}
|
||||
<tr>
|
||||
<td>
|
||||
<span title="Capabilities: {{#each this.capabilities}}
|
||||
* {{this.name}} {{/each}}">
|
||||
{{this.name}}
|
||||
</span>
|
||||
{{this}}
|
||||
</td>
|
||||
</tr>
|
||||
{{/each}}
|
||||
|
|
Loading…
Reference in New Issue