List the configured projects on the home page

Calling this for the night, since the path to views for projects is pretty
straightforward, and will be easy to pick back up later and get into the swing
of things
This commit is contained in:
R Tyler Croy 2023-01-28 21:43:45 -08:00
parent ceb24a296a
commit c256be98d8
No known key found for this signature in database
GPG Key ID: E5C92681BEF6CEA2
2 changed files with 14 additions and 7 deletions

View File

@ -13,7 +13,7 @@ use dotenv::dotenv;
use gumdrop::Options;
use handlebars::Handlebars;
use log::*;
use serde::Deserialize;
use serde::{Deserialize, Serialize};
use sqlx::SqlitePool;
use url::Url;
@ -76,7 +76,8 @@ mod routes {
*/
pub async fn index(req: Request<AppState<'_>>) -> Result<Body, tide::Error> {
let params = json!({
"page": "home"
"page": "home",
"config" : req.state().config,
});
let mut body = req.state().render("index", &params).await?;
@ -164,7 +165,7 @@ struct JankyYml {
commands: Vec<String>,
}
#[derive(Clone, Debug, Deserialize)]
#[derive(Clone, Debug, Deserialize, Serialize)]
#[serde(rename_all = "lowercase")]
enum Scm {
GitHub {
@ -175,7 +176,7 @@ enum Scm {
},
}
#[derive(Clone, Debug, Deserialize)]
#[derive(Clone, Debug, Deserialize, Serialize)]
#[serde(rename_all = "lowercase")]
struct Project {
#[serde(with = "serde_yaml::with::singleton_map")]
@ -189,7 +190,7 @@ struct Project {
* Loaded meaning the server has pinged the agent and gotten necessary bootstrap
* information
*/
#[derive(Clone, Debug)]
#[derive(Clone, Debug, Serialize)]
pub struct Agent {
url: Url,
capabilities: Vec<janky::Capability>,
@ -211,7 +212,7 @@ impl Agent {
}
}
#[derive(Clone, Debug, Deserialize)]
#[derive(Clone, Debug, Deserialize, Serialize)]
pub struct ServerConfig {
agents: Vec<Url>,
projects: HashMap<String, Project>,

View File

@ -10,7 +10,13 @@
<main role="main" class="inner cover">
<p>
This is so Janky
</p>
</p>
<div id="projects">
<ul>
{{#each config.projects}}
<li><a href="/projects/{{@key}}"><strong>{{@key}}</strong></a></li>
{{/each}}
</div>
</main>
</div>
</body>