aboutsummaryrefslogtreecommitdiffstats
path: root/browser/templates
diff options
context:
space:
mode:
authorJan Tuomi <jan@jantuomi.fi>2025-02-11 00:25:57 +0200
committerJan Tuomi <jan@jantuomi.fi>2025-02-11 00:25:57 +0200
commitcc07b3fdc4b8860a1ee1b25f09039ba3f13ee509 (patch)
tree7437823d5ff2202912d32c9024640ce993202131 /browser/templates
parentff8b5f63ca6bf0bdbfd36edcaed4091d9d25c3de (diff)
Add initial browser UI app
Diffstat (limited to 'browser/templates')
-rw-r--r--browser/templates/aside.html.j216
-rw-r--r--browser/templates/base.html.j220
-rw-r--r--browser/templates/error.html.j26
-rw-r--r--browser/templates/form_find.html.j26
-rw-r--r--browser/templates/form_range.html.j28
-rw-r--r--browser/templates/index.html.j228
6 files changed, 84 insertions, 0 deletions
diff --git a/browser/templates/aside.html.j2 b/browser/templates/aside.html.j2
new file mode 100644
index 0000000..eb8c9cf
--- /dev/null
+++ b/browser/templates/aside.html.j2
@@ -0,0 +1,16 @@
+{% block aside %}
+<aside>
+ <h3>Read operations</h3>
+ <ul>
+ <li><a href="/find">Find</a></li>
+ <li><a href="/range">Range</a></li>
+ </ul>
+ <h3>Write operations</h3>
+ <ul>
+ <li><a href="/upsert">Upsert</a></li>
+ <li><a href="/delete">Delete</a></li>
+ </ul>
+
+ {% include selected_form %}
+</aside>
+{% endblock %}
diff --git a/browser/templates/base.html.j2 b/browser/templates/base.html.j2
new file mode 100644
index 0000000..a8a6cf7
--- /dev/null
+++ b/browser/templates/base.html.j2
@@ -0,0 +1,20 @@
+<!DOCTYPE html>
+<html lang="en">
+<head>
+ <meta charset="utf-8">
+ <meta name="viewport" content="width=device-width, initial-scale=1">
+ <link rel="preload" href="/static/InclusiveSans-Regular.ttf" as="font" type="font/woff2" crossorigin="anonymous">
+ <link rel="stylesheet" href="/static/styles.css"></link>
+ {% block head_meta %}
+ <title>Database browser</title>
+ <meta name="description" content="Database browser for log_db">
+ {% endblock %}
+
+ <!-- -- https://leanrada.com/htmz/ -->
+ <iframe hidden name=htmz onload="setTimeout(()=>document.querySelector(contentWindow.location.hash||null)?.replaceWith(...contentDocument.body.childNodes))"></iframe>
+</head>
+<body>
+ <h1><a href="/">Database browser</a></h1>
+ {% block content %}{% endblock %}
+</body>
+</html>
diff --git a/browser/templates/error.html.j2 b/browser/templates/error.html.j2
new file mode 100644
index 0000000..2d0dc19
--- /dev/null
+++ b/browser/templates/error.html.j2
@@ -0,0 +1,6 @@
+{% extends "base.html.j2" %}
+
+{% block content %}
+<h2>Error</h2>
+{{ error }}
+{% endblock %}
diff --git a/browser/templates/form_find.html.j2 b/browser/templates/form_find.html.j2
new file mode 100644
index 0000000..54608b6
--- /dev/null
+++ b/browser/templates/form_find.html.j2
@@ -0,0 +1,6 @@
+<form action="/find" method="post">
+ <label for="field">Field</label>
+ <input type="text" name="field" id="field" required>
+ <label for="values">Values</label>
+ <input type="text" name="values" id="values" required>
+ <button type="submit">Run query</button>
diff --git a/browser/templates/form_range.html.j2 b/browser/templates/form_range.html.j2
new file mode 100644
index 0000000..76eb4d2
--- /dev/null
+++ b/browser/templates/form_range.html.j2
@@ -0,0 +1,8 @@
+<form action="/range" method="post">
+ <label for="field">Field</label>
+ <input type="text" name="field" id="field" required>
+ <label for="values">From...</label>
+ <input type="text" name="from" id="from" required>
+ <label for="values">...To</label>
+ <input type="text" name="to" id="to" required>
+ <button type="submit">Run query</button>
diff --git a/browser/templates/index.html.j2 b/browser/templates/index.html.j2
new file mode 100644
index 0000000..9713944
--- /dev/null
+++ b/browser/templates/index.html.j2
@@ -0,0 +1,28 @@
+{% extends "base.html.j2" %}
+
+{% block content %}
+<main>
+ {% include "aside.html.j2" %}
+
+ <div class="results">
+ <table>
+ <thead>
+ <tr>
+ {% for field_name in field_names %}
+ <th>{{ field_name }}</th>
+ {% endfor %}
+ </tr>
+ </thead>
+ <tbody>
+ {% for row in rows %}
+ <tr>
+ {% for field in row %}
+ <td>{{ field }}</td>
+ {% endfor %}
+ </tr>
+ {% endfor %}
+ </tbody>
+ </table>
+ </div>
+</main>
+{% endblock %}