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

+4
View File
@@ -16,6 +16,10 @@ nix build
nix build .#development-environment
```
Then, in IntelliJ use `result/bin`
The rust source must be `/nix/store/pmih7jv9r5xfaif92bza8w05876qvnvc-rust-src/`
#### For shell
```shell
+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", ())
}
+47
View File
@@ -0,0 +1,47 @@
{% set active_navbar_item = 'actions' %}
{% extends "base.html" %}
{% block body %}
<div>
<form>
<fieldset class="uk-fieldset">
<legend class="uk-legend">Legend</legend>
<div class="uk-margin">
<input class="uk-input" type="text" placeholder="Input" aria-label="Input">
</div>
<div class="uk-margin">
<select class="uk-select" aria-label="Select">
<option>Option 01</option>
<option>Option 02</option>
</select>
</div>
<div class="uk-margin">
<textarea class="uk-textarea" rows="5" placeholder="Textarea" aria-label="Textarea"></textarea>
</div>
<div class="uk-margin uk-grid-small uk-child-width-auto uk-grid">
<label><input class="uk-radio" type="radio" name="radio2" checked> A</label>
<label><input class="uk-radio" type="radio" name="radio2"> B</label>
</div>
<div class="uk-margin uk-grid-small uk-child-width-auto uk-grid">
<label><input class="uk-checkbox" type="checkbox" checked> A</label>
<label><input class="uk-checkbox" type="checkbox"> B</label>
</div>
<div class="uk-margin">
<input class="uk-range" type="range" value="2" min="0" max="10" step="0.1" aria-label="Range">
</div>
</fieldset>
</form>
</div>
{% endblock %}
+8 -1
View File
@@ -11,7 +11,14 @@
<body>
<nav class="uk-navbar">
<a href="" class="uk-navbar-brand">Ledger</a>
<a href="/" class="uk-navbar-brand">Ledger</a>
<ul class="uk-navbar-nav">
{% set nav_bar_items = [{'id': 'overview', 'label': 'Overview'},
{'id': 'actions', 'label': 'Actions'}]%}
{% for itm in nav_bar_items %}
<li class="{% if active_navbar_item == itm.id %}uk-active"{% else %} uk-parent {% endif %}"><a href="{{ itm.id }}">{{ itm.label }}</a></li>
{% endfor %}
</ul>
</nav>
<div class="uk-grid">
View File
Whitespace-only changes.
+12
View File
@@ -0,0 +1,12 @@
{% set active_navbar_item = 'overview' %}
{% extends "base.html" %}
{% block body %}
overview
{% for i in [{'a': 90}, 2, 3] %}
lll {{ i }}
{% endfor %}
{% endblock %}