going somewhere.

This commit is contained in:
didier amyot committed 2023-02-05 09:57:26 -05:00
1 parent 6092273c76
commit de51e20181
9 files changed
+98 -4

No files matched your search

+2 -2
View File
@@ -498,7 +498,7 @@ impl CommandLineUserLogic for ProCommandLineLogic {
}
fn process_events(&mut self, conn: &mut Connection, files: ValuesRef<PathBuf>) {
process_event_files(conn, files);
process_event_files(conn, files).unwrap();
println!("fuck me");
}
@@ -506,7 +506,7 @@ impl CommandLineUserLogic for ProCommandLineLogic {
fn run_webui(&mut self, conn: &mut Connection, port: u16, enable_template_autoreload: bool) {
info!("Serving web-ui on port {:?}", port);
web_ui_main(port,
enable_template_autoreload);
enable_template_autoreload).unwrap();
}
}
+3
View File
@@ -0,0 +1,3 @@
struct Config {
path: str,
}
+4 -1
View File
@@ -1,4 +1,5 @@
mod views;
mod config;
use actix_utils::future::{ready, Ready};
use minijinja;
@@ -68,7 +69,7 @@ pub async fn web_ui_main(port: u16, enable_template_autoreload: bool) -> std::io
notifier.watch_path(&tmpl_path, true);
}
env.set_source(minijinja::Source::from_path(tmpl_path));
println!("boom");
Ok(env)
});
@@ -78,6 +79,8 @@ pub async fn web_ui_main(port: u16, enable_template_autoreload: bool) -> std::io
App::new()
.app_data(tmpl_reloader.clone())
.service(views::index)
.service(views::actions)
.service(views::overview)
.wrap(ErrorHandlers::new().handler(StatusCode::NOT_FOUND, not_found))
.wrap(Logger::default())
})
+18
View File
@@ -1,5 +1,6 @@
use crate::webui::MiniJinjaRenderer;
use actix_web::{web, Responder};
use actix_web::http::header::q;
use std::collections::HashMap;
#[actix_web::get("/")]
@@ -9,3 +10,20 @@ pub async fn index(
) -> actix_web::Result<impl Responder> {
tmpl_env.render("index.html", ())
}
#[actix_web::get("/actions")]
pub async fn actions(
tmpl_env: MiniJinjaRenderer,
query: web::Query<HashMap<String, String>>,
) -> actix_web::Result<impl Responder> {
tmpl_env.render("actions.html", ())
}
#[actix_web::get("/overview")]
pub async fn overview(
tmpl_env: MiniJinjaRenderer,
query: web::Query<HashMap<String, String>>,
) -> actix_web::Result<impl Responder> {
tmpl_env.render("overview.html", ())
}