aboutsummaryrefslogtreecommitdiffstats
path: root/templates
diff options
context:
space:
mode:
authorficus <ficus@robocracy.org>2012-09-14 20:10:43 +0200
committerficus <ficus@robocracy.org>2012-09-14 20:10:43 +0200
commita304d7a56563b16ca98d9b45ebed521c52f6347c (patch)
treeda88f01977c08d9a149c3e767f1a7e62981500b9 /templates
downloadtui-a304d7a56563b16ca98d9b45ebed521c52f6347c.tar.gz
tui-a304d7a56563b16ca98d9b45ebed521c52f6347c.zip
backup WIP
Diffstat (limited to 'templates')
-rw-r--r--templates/base.html77
-rw-r--r--templates/home.html39
-rw-r--r--templates/lib.html41
-rw-r--r--templates/logs.html9
-rw-r--r--templates/processes.html28
-rw-r--r--templates/reboot.html22
-rw-r--r--templates/wan.html0
7 files changed, 216 insertions, 0 deletions
diff --git a/templates/base.html b/templates/base.html
new file mode 100644
index 0000000..a2c1407
--- /dev/null
+++ b/templates/base.html
@@ -0,0 +1,77 @@
+<!doctype html>
+<html>
+<head>
+ <title>torouter configuration interface</title>
+ <link href="/static/css/bootstrap.min.css" rel="stylesheet">
+ <style type="text/css">
+ body {
+ padding-top: 60px;
+ padding-bottom: 40px;
+ }
+ .sidebar-nav {
+ padding: 9px 0;
+ }
+ </style>
+</head>
+<body>
+
+<div class="navbar navbar-inverse navbar-fixed-top">
+ <div class="navbar-inner">
+ <div class="container-fluid">
+ <a class="brand" href="#">torouter</a>
+ <div class="nav-collapse collapse">
+ <p class="navbar-text pull-right">
+ version 0.0
+ </p>
+ </div><!--/.nav-collapse -->
+ </div>
+ </div>
+</div>
+
+<div class="container-fluid">
+ <div class="row-fluid">
+ <div class="span3">
+ <div class="well sidebar-nav">
+ <ul class="nav nav-list">
+{% macro pagelink(path, name) -%}
+ <li {% if path == request.path %}class="active"{% endif %}><a href="{{path}}">{{name}}</a></li>
+{%- endmacro %}
+ {{ pagelink("/", "Status") }}
+ {{ pagelink("/admin/", "Administration") }}
+ {{ pagelink("/reboot/", "Reboot...") }}
+ <li class="nav-header">Configuration</li>
+ {{ pagelink("/wan/", "Upstream") }}
+ {{ pagelink("/lan/", "Local") }}
+ {{ pagelink("/wireless/", "Wireless") }}
+ {{ pagelink("/tor/", "Tor") }}
+ <li class="nav-header">Monitoring</li>
+ {{ pagelink("/logs/", "Logs") }}
+ {{ pagelink("/processes/", "Processes") }}
+ </ul>
+ </div><!--/.well -->
+ </div><!--/span-->
+ <div class="span9">
+ {% with messages = get_flashed_messages(with_categories=true) %}
+ {% if messages %}
+ {% for category, message in messages %}
+ <div class="alert alert-{{ category }}">
+ <button type="button" class="close" data-dismiss="alert">×</button>
+ {% if category == "warning" %}<strong>Warning:</strong>{% endif %}
+ {% if category == "error" %}<strong>Error:</strong>{% endif %}
+ {% if category == "info" %}<strong>Note:</strong>{% endif %}
+ {{ message }}
+ </div>
+ {% endfor %}
+ {% endif %}
+ {% endwith %}
+{% block body %}{% endblock %}
+ </div><!--/span-->
+ </div><!--/row-->
+ <hr>
+ <footer>
+ <p>&copy; torouter, copyleft 2012</p>
+ </footer>
+</div><!--/.fluid-container-->
+
+</body>
+</html>
diff --git a/templates/home.html b/templates/home.html
new file mode 100644
index 0000000..30c328e
--- /dev/null
+++ b/templates/home.html
@@ -0,0 +1,39 @@
+{% import "lib.html" as lib %}
+{% extends "base.html" %}
+{% block body %}
+<h3>System</h3>
+
+<table class="table table-condensed">
+ <tr>
+ <th>Host Name
+ <td><code>{{ status.system.hostname }}</code>
+ <tr>
+ <th>Current Time
+ <td><code>{{ status.system.current_time }}</code>
+ <tr>
+ <th>System Uptime
+ <td><code>{{ status.system.uptime }}</code>
+</table>
+
+<h3>WAN</h3>
+{% if not status.wan %}
+Upstream ethernet interface hardware not detected at all!
+{% else %}
+{{ lib.ifstatus(status.wan) }}
+{% endif %}
+
+<h3>LAN</h3>
+{% if not status.lan %}
+Local network ethernet interface hardware not detected at all!
+{% else %}
+{{ lib.ifstatus(status.lan) }}
+{% endif %}
+
+<h3>Wireless</h3>
+{% if not status.wireless %}
+Wireless interface hardware not detected at all!
+{% else %}
+{{ lib.ifstatus(status.wireless) }}
+{% endif %}
+
+{% endblock %}
diff --git a/templates/lib.html b/templates/lib.html
new file mode 100644
index 0000000..33534da
--- /dev/null
+++ b/templates/lib.html
@@ -0,0 +1,41 @@
+
+{% macro ifstatus(ifstatus) -%}
+<table class="table table-condensed">
+ <tr>
+ <th>Interface Name
+ <td><code>{{ ifstatus.ifname }}</code>
+ <tr>
+ <th>Status
+ <td><span style="font-weight: bold; color:
+ {% if ifstatus.state == 'UP' %}green{% else %}red{% endif %};">
+ {{ ifstatus.state }}
+ </span>
+ <tr>
+ <th>MAC Address
+ <td><code>{{ ifstatus.mac }}</code>
+ <tr>
+ <th>IPv4 Addresses
+ <td><code>
+ {% for addr in ifstatus.ipv4addrs %}
+ {{ addr.addr }}/{{ addr.prefix}} ({{ addr.scope }})<br>
+ {% endfor %}</code>
+ <tr>
+ <th>IPv6 Addresses
+ <td><code>
+ {% for addr in ifstatus.ipv6addrs %}
+ {{ addr.addr }}/{{ addr.prefix}} ({{ addr.scope }})<br>
+ {% endfor %}</code>
+</table>
+{%- endmacro %}
+
+{% macro logbox(name, contents) -%}
+<h3>{{name}}</h3>
+{% if contents == None %}
+<span class="text-error">Access to {{name}} was denied, or file did not exist.</span>
+{% else %}
+
+<pre style="height: 18em; width 40em; overflow: auto;">
+{{ contents }}
+</pre>
+{% endif%}
+{%- endmacro %}
diff --git a/templates/logs.html b/templates/logs.html
new file mode 100644
index 0000000..c5ea52a
--- /dev/null
+++ b/templates/logs.html
@@ -0,0 +1,9 @@
+{% import "lib.html" as lib %}
+{% extends "base.html" %}
+{% block body %}
+
+{{ lib.logbox("dmesg", logs.dmesg) }}
+{{ lib.logbox("auth.log", logs.authlog) }}
+{{ lib.logbox("syslog", logs.syslog) }}
+
+{% endblock %}
diff --git a/templates/processes.html b/templates/processes.html
new file mode 100644
index 0000000..c911b0a
--- /dev/null
+++ b/templates/processes.html
@@ -0,0 +1,28 @@
+{% import "lib.html" as lib %}
+{% extends "base.html" %}
+{% block body %}
+<h3>System Running Process List</h3>
+<table class="table table-condensed">
+ <tr>
+ <th>User
+ <th>PID
+ <th>%CPU
+ <th>%MEM
+ <th>Status Code
+ <th>Started
+ <th>Time
+ <th>Command
+{% for proc in process_list %}
+ <tr>
+ <td>{{ proc.user }}
+ <td>{{ proc.pid}}
+ <td>{{ proc.perc_cpu }}
+ <td>{{ proc.perc_mem }}
+ <td>{{ proc.status_code }}
+ <td>{{ proc.started }}
+ <td>{{ proc.time }}
+ <td>{{ proc.command }}
+{% endfor %}
+</table>
+
+{% endblock %}
diff --git a/templates/reboot.html b/templates/reboot.html
new file mode 100644
index 0000000..b9f0c54
--- /dev/null
+++ b/templates/reboot.html
@@ -0,0 +1,22 @@
+{% extends "base.html" %}
+{% block body %}
+<h3>System Reboot</h3>
+
+{% if status == 'rebooting' %}
+
+Rebooting! This interface will stop working in a few seconds, check back in a
+minute or two...
+
+{% else %}
+<form action="/reboot/" method="POST">
+Are you sure you'd like to restart? This could have reprecussions!
+<br>
+<label class="checkbox">
+ <input type="checkbox" name="confirm">Yes, i'm certain
+</label>
+<button type="submit" class="btn btn-large btn-primary btn-warning" type="button">
+Restart</button>
+</form>
+{% endif %}
+
+{% endblock %}
diff --git a/templates/wan.html b/templates/wan.html
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/templates/wan.html