aboutsummaryrefslogtreecommitdiff
path: root/templates
diff options
context:
space:
mode:
authorCara Salter <cara@devcara.com>2022-07-20 10:31:01 -0400
committerCara Salter <cara@devcara.com>2022-07-20 10:31:01 -0400
commit4b616447715b8129ae322341959e1c2bfabbd10e (patch)
tree01c23c8a5e29d2821cdd1047d0ec27a69f8b1138 /templates
parentb98646d8501689072f5624483d258adcbf6fc5c5 (diff)
downloadnccd-4b616447715b8129ae322341959e1c2bfabbd10e.tar.gz
nccd-4b616447715b8129ae322341959e1c2bfabbd10e.zip
emails
also subnet storage
Diffstat (limited to 'templates')
-rw-r--r--templates/index.rs.html63
-rw-r--r--templates/new_net.rs.html21
2 files changed, 81 insertions, 3 deletions
diff --git a/templates/index.rs.html b/templates/index.rs.html
index d0196df..e686b01 100644
--- a/templates/index.rs.html
+++ b/templates/index.rs.html
@@ -1,12 +1,69 @@
@use super::{header_html, footer_html};
-@use crate::models::DbUser;
+@use crate::models::{DbUser, Peer, Network};
-@(user: Option<DbUser>)
+@(user: Option<DbUser>, peers: Vec<Peer>, nets: Vec<Network>)
@:header_html()
<h1>NCCd (Network Communications Control Daemon)</h1>
@if user.is_some() {
- <h3>Welcome @user.unwrap().pref_name</h3>
+ <h3>Welcome @user.clone().unwrap().pref_name</h3>
+ <table>
+ <tr>
+ <th>Key</th>
+ <th>Value</th>
+ </tr>
+ <tr>
+ <td>ID</td>
+ <td>@user.clone().unwrap().id</td>
+ </tr>
+ <tr>
+ <td>Email</td>
+ <td>@user.clone().unwrap().email</td>
+ </tr>
+ <tr>
+ <td>Preferred Name</td>
+ <td>@user.clone().unwrap().pref_name</td>
+ </tr>
+ <tr>
+ <td>Last Login</td>
+ <td>@(user.clone().unwrap().last_login)Z</td>
+ </tr>
+ </table>
+
+ <hr>
+
+ <h3>Configured Peers</h3>
+ <table>
+ <tr>
+ <th>ID</th>
+ <th>Address</th>
+ <th>Public Key</th>
+ </tr>
+ @for p in peers {
+ <tr>
+ <td>@p.id</td>
+ <td>@p.addr</td>
+ <td>@p.public_key</td>
+ </tr>
+ }
+ </table>
+ <hr>
+ <h3>Configured subnets (<a href="/dash/nets/new">New</a>)</h3>
+ <table>
+ <tr>
+ <th>ID</th>
+ <th>Subnet CIDR</th>
+ <th>Description</th>
+ </tr>
+ @for n in nets {
+ <tr>
+ <td>@n.id</td>
+ <td>@n.subnet</td>
+ <td>@if n.description.is_some() { @n.description.unwrap()
+ } else { None }</td>
+ </tr>
+ }
+ </table>
} else {
<h3>Please <a href="/dash/auth/login">Log in</a></h3>
diff --git a/templates/new_net.rs.html b/templates/new_net.rs.html
new file mode 100644
index 0000000..4628432
--- /dev/null
+++ b/templates/new_net.rs.html
@@ -0,0 +1,21 @@
+@use super::{header_html, footer_html};
+
+@()
+
+@:header_html()
+
+<h1>New Subnet</h1>
+
+<form method="POST">
+ <div>
+ <label for="subnet">Subnet CIDR</label>
+ <input type="text" name="subnet" required>
+ </div>
+ <div>
+ <label for="description">Description</label>
+ <textarea name="description"></textarea>
+ </div>
+ <button type="submit" class="accent">Submit</button>
+</form>
+
+@:footer_html()