aboutsummaryrefslogtreecommitdiffstats
path: root/templates
diff options
context:
space:
mode:
authorficus <ficus@robocracy.org>2012-09-15 22:50:14 +0200
committerficus <ficus@robocracy.org>2012-09-15 22:50:14 +0200
commitced83335a5a338cb9c24956b96da526465d94df8 (patch)
treeb345cd21dfcbb9e660aceb2433c92bd50848938f /templates
parent57a1e70dee45f5cd9493d6d23f8fc7b6435d5388 (diff)
downloadtui-ced83335a5a338cb9c24956b96da526465d94df8.tar.gz
tui-ced83335a5a338cb9c24956b96da526465d94df8.zip
refactor to distributable format
Diffstat (limited to 'templates')
-rw-r--r--templates/base.html75
-rw-r--r--templates/home.html71
-rw-r--r--templates/lan.html32
-rw-r--r--templates/lib.html84
-rw-r--r--templates/logs.html9
-rw-r--r--templates/processes.html28
-rw-r--r--templates/reboot.html22
-rw-r--r--templates/tor.html19
-rw-r--r--templates/wan.html35
-rw-r--r--templates/wifi.html38
10 files changed, 0 insertions, 413 deletions
diff --git a/templates/base.html b/templates/base.html
deleted file mode 100644
index 4c15c73..0000000
--- a/templates/base.html
+++ /dev/null
@@ -1,75 +0,0 @@
-<!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("/reboot/", "Reboot...") }}
- <li class="nav-header">Configuration</li>
- {{ pagelink("/wan/", "Upstream Ethernet") }}
- {{ pagelink("/lan/", "Local Ethernet") }}
- {{ pagelink("/wifi/", "WiFi") }}
- {{ pagelink("/tor/", "Tor Network") }}
- <li class="nav-header">Monitoring</li>
- {{ pagelink("/logs/", "Logs") }}
- {{ pagelink("/processes/", "Processes") }}
- </ul>
- </div><!--/.well -->
- </div><!--/span-->
- <div class="span9">
- {% if messages %}
- {{ mesages }}
- {% 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 %}
-{% 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
deleted file mode 100644
index fa2ed2b..0000000
--- a/templates/home.html
+++ /dev/null
@@ -1,71 +0,0 @@
-{% import "lib.html" as lib %}
-{% extends "base.html" %}
-{% block body %}
-
-
-<div class="row-fluid">
- <div class="span6">
- <h3>System</h3>
- <table class="table table-condensed">
- <tr>
- <th>Host Name
- <td><span style="font-family:monospace;">{{ status.system.hostname }}</span>
- <tr>
- <th>Current Time
- <td><span style="font-family:monospace;">{{ status.system.current_time }}</span>
- <tr>
- <th>System Uptime
- <td><span style="font-family:monospace;">{{ status.system.uptime }}</span>
- </table>
- </div>
- <div class="span6">
- <h3>Resources</h3>
- <ul class="unstyled">
- <li>
- CPU Load<span class="pull-right strong">{{status.resources.cpu_load}} / {{status.resources.cpu_cores}} cores</span>
- <div class="progress progress-striped ">
- <div class="bar" style="width: {{status.resources.cpu_percent}}%;"></div>
- </div>
- </li>
- <li>RAM Usage<span class="pull-right strong">{{status.resources.ram_used}} / {{status.resources.ram_avail}}</span>
- <div class="progress progress-success progress-striped ">
- <div class="bar" style="width: {{ status.resources.ram_percent }}%;"></div>
- </div>
- </li>
- <li>Primary Disk Space<span class="pull-right strong">{{status.resources.disk_used}} / {{status.resources.disk_avail}}</span>
- <div class="progress progress-warning progress-striped ">
- <div class="bar" style="width: {{ status.resources.disk_percent }}%;"></div>
- </div>
- </li>
- </ul>
- </div>
-</div>
-<div class="row-fluid">
- <div class="span6">
- <h3>WAN</h3>
- {{ lib.ifstatus(status.wan) }}
- </div>
- <div class="span6">
- <h3>LAN</h3>
- {{ lib.ifstatus(status.lan) }}
- </div>
-</div>
-<div class="row-fluid">
- <div class="span6">
- <h3>WiFi</h3>
- {{ lib.ifstatus(status.wifi) }}
- </div>
- <div class="span6">
- <h3>Tor</h3>
- <table class="table table-condensed {% if status.tor.state in ["DISABLED"] %}muted{% endif %}">
- <tr>
- <th>Status
- <td><span style="font-weight: bold;" class="label
- {% if status.tor.state == 'RUNNING' %}label-success{% elif status.tor.state == 'STARTING' %}label-info{% else %}label-important{% endif %}">
- {{ status.tor.state }}
- </span>
- </table>
- </div>
-</div>
-
-{% endblock %}
diff --git a/templates/lan.html b/templates/lan.html
deleted file mode 100644
index 09bcf0a..0000000
--- a/templates/lan.html
+++ /dev/null
@@ -1,32 +0,0 @@
-{% import "lib.html" as lib %}
-{% extends "base.html" %}
-{% block body %}
-
-<form action="/lan/" method="POST" class="form-horizontal">
-<legend>Local Ethernet Configuration</legend>
-
-{% if not status.lan %}
-<span class="text-error">Could not find the local ethernet hardware device!</span>
-{% else %}
-
-{{ lib.formcheckbox(form, formerr, 'ipv4enable', 'Enable this interface', 'true') }}
-
-<legend>Address Configuration</legend>
-{{ lib.forminput(form, formerr, 'ipv4addr', 'IPv4 Address', '0.0.0.0') }}
-{{ lib.forminput(form, formerr, 'ipv4netmask', 'Netmask', '255.255.0.0') }}
-{{ lib.forminput(form, formerr, 'ipv4gateway', 'Gateway IP Address', '0.0.0.0') }}
-
-<legend>DHCP Configuration</legend>
-{{ lib.forminput(form, formerr, 'dhcpbase', 'DHCP Range Base', '192.168.1.100') }}
-{{ lib.forminput(form, formerr, 'dhcptop', 'DHCP Range Top', '192.168.1.200') }}
-{{ lib.forminput(form, formerr, 'dhcptime', 'Lease Time', '12h') }}
-
-<div class="pull-right">
-<a href="."><button class="btn" type="button">Reset</button></a>
-<button type="submit" class="btn btn-primary" type="button">
-Save</button>
-</div>
-</form>
-{% endif %}
-
-{% endblock %}
diff --git a/templates/lib.html b/templates/lib.html
deleted file mode 100644
index 6ac5e12..0000000
--- a/templates/lib.html
+++ /dev/null
@@ -1,84 +0,0 @@
-
-
-{% macro ifstatus(ifstatus) -%}
-{% if not ifstatus %}
-<span class="text-error">
-Network hardware not detected at all!
-</span>
-{% else %}
-<table class="table table-condensed {% if ifstatus.state in ["DOWN", "DISCONNECTED"] %}muted{% endif %}">
- <tr>
- <th>Interface Name
- <td><span style="font-family:monospace;">{{ ifstatus.ifname }}</span>
- <tr>
- <th>Status
- <td><span style="font-weight: bold;" class="label
- {% if ifstatus.state == 'RUNNING' %}label-success{% elif ifstatus.state == 'up' %}label-info{% else %}label-important{% endif %}">
- {{ ifstatus.state }}
- </span>
- <tr>
- <th>MAC Address
- <td><span style="font-family:monospace;">{{ ifstatus.mac }}</span>
- <tr>
- <th>IPv4 Addresses
- <td><span style="font-family:monospace;">
- {% for addr in ifstatus.ipv4addrs %}
- {{ addr.addr }}/{{ addr.prefix}} ({{ addr.scope }})<br>
- {% endfor %}</span>
- <tr>
- <th>IPv6 Addresses
- <td><span style="font-family:monospace;">
- {% for addr in ifstatus.ipv6addrs %}
- {{ addr.addr }}/{{ addr.prefix}} ({{ addr.scope }})<br>
- {% endfor %}</span>
- {% if ifstatus.radio_state %}
- <tr>
- <th>Radio State
- <td><span style="font-family:monospace;">{{ ifstatus.radio_state }}</span>
- <tr>
- <th>SSID
- <td><span style="font-family:monospace;">{{ ifstatus.ssid }}</span>
- <tr>
- <th>Frequency
- <td><span style="font-family:monospace;">{{ ifstatus.freq }}</span>
- <tr>
- <th>Signal Strength
- <td><span style="font-family:monospace;">{{ ifstatus.signal_dbm }}</span>
- {% endif %}
-</table>
-{% endif %}
-{%- 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 %}
-<div style="height: 18em; width: 60em;">
-<pre style="height: 18em; width 60em; overflow: auto;">
-{{ contents }}
-</pre>
-</div>
-{% endif%}
-{%- endmacro %}
-
-
-{% macro forminput(form, formerr, name, title, placeholder) -%}
-<div class="control-group {% if formerr[name] %}error{% endif %}">
- <label class="control-label" for="{{name}}">{{ title }}</label>
- <div class="controls">
- <input type="text" name="{{name}}" placeholder="{{placeholder}}" {% if form[name] %}value="{{ form[name] }}"{% endif %}>
- {% if formerr[name] %}
- <span class="help-inline">{{ formerr[name] }}</span>
- {% endif %}
- </div>
-</div>
-{%- endmacro %}
-
-{% macro formcheckbox(form, formerr, name, title, value) -%}
- <label class="checkbox">
- <input type="checkbox" name="{{name}}" id="{{name}}" value="{{value}}" {% if form[name] == value %}checked{% endif %}>
- <h4>{{title}}</h4>
- </label>
-{% endmacro %}
diff --git a/templates/logs.html b/templates/logs.html
deleted file mode 100644
index c5ea52a..0000000
--- a/templates/logs.html
+++ /dev/null
@@ -1,9 +0,0 @@
-{% 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
deleted file mode 100644
index 2e35162..0000000
--- a/templates/processes.html
+++ /dev/null
@@ -1,28 +0,0 @@
-{% 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
- <th>Started
- <th>Time
- <th>Command
-{% for proc in process_list %}
- <tr style="font-family: monospace;">
- <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><div style="height: 1.5em; overflow:hidden;">{{ proc.command }}</div>
-{% endfor %}
-</table>
-
-{% endblock %}
diff --git a/templates/reboot.html b/templates/reboot.html
deleted file mode 100644
index b9f0c54..0000000
--- a/templates/reboot.html
+++ /dev/null
@@ -1,22 +0,0 @@
-{% 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/tor.html b/templates/tor.html
deleted file mode 100644
index a1f30dc..0000000
--- a/templates/tor.html
+++ /dev/null
@@ -1,19 +0,0 @@
-{% import "lib.html" as lib %}
-{% extends "base.html" %}
-{% block body %}
-
-<form action="/tor/" method="POST" class="form-horizontal">
-<legend>Tor Network Configuration</legend>
-
-{{ lib.formcheckbox(form, formerr, 'torenable', 'Enable Tor daemon', 'true') }}
-{{ lib.formcheckbox(form, formerr, 'torrelayenable', 'Enable Tor Relay', 'true') }}
-{{ lib.formcheckbox(form, formerr, 'torbridgeenable', 'Enable Tor Bridge', 'true') }}
-
-<div class="pull-right">
-<a href="."><button class="btn" type="button">Reset</button></a>
-<button type="submit" class="btn btn-primary" type="button">
-Save</button>
-</div>
-</form>
-
-{% endblock %}
diff --git a/templates/wan.html b/templates/wan.html
deleted file mode 100644
index 2da2733..0000000
--- a/templates/wan.html
+++ /dev/null
@@ -1,35 +0,0 @@
-{% import "lib.html" as lib %}
-{% extends "base.html" %}
-{% block body %}
-
-<form action="/wan/" method="POST" class="form-horizontal">
-<legend>Upstream Ethernet Configuration</legend>
-
-<label class="radio">
- <input type="radio" name="ipv4method" id="ipv4methoddhcp" value="dhcp" {% if form.ipv4method == "dhcp" %}checked{% endif %}>
- <h4>Automatic DHCP Addressing</h4>
-</label>
-
-<label class="radio">
- <input type="radio" name="ipv4method" id="ipv4methodstatic" value="static" {% if form.ipv4method == "static" %}checked{% endif %}>
- <h4>Manual Addressing</h4>
-</label>
-
-{{ lib.forminput(form, formerr, 'ipv4addr', 'IPv4 Address', '0.0.0.0') }}
-{{ lib.forminput(form, formerr, 'ipv4netmask', 'Netmask', '255.255.255.0') }}
-{{ lib.forminput(form, formerr, 'ipv4gateway', 'Gateway IP Address', '0.0.0.0') }}
-
-<label class="radio">
- <input type="radio" name="ipv4method" id="ipv4methoddisabled" value="disabled" {% if form.ipv4method == "disabled" %}checked{% endif %}>
- <h4>Disable Interface</h4>
-</label>
-
-<div class="pull-right">
-<a href="."><button class="btn" type="button">Reset</button></a>
-<button type="submit" class="btn btn-primary" type="button">
-Save</button>
-</div>
-</form>
-
-
-{% endblock %}
diff --git a/templates/wifi.html b/templates/wifi.html
deleted file mode 100644
index 3e41788..0000000
--- a/templates/wifi.html
+++ /dev/null
@@ -1,38 +0,0 @@
-{% import "lib.html" as lib %}
-{% extends "base.html" %}
-{% block body %}
-
-<form action="/wifi/" method="POST" class="form-horizontal">
-<legend>WiFi Configuration</legend>
-
-{% if not status.wifi %}
-<span class="text-error">Could not find the WiFi hardware device!</span>
-{% else %}
-
-{{ lib.formcheckbox(form, formerr, 'wifienable', 'Enable the radio', 'true') }}
-{{ lib.formcheckbox(form, formerr, 'torifylanenable', 'Transparently "Tor-ify" this network interface', 'true') }}
-
-<legend>Radio</legend>
-{{ lib.forminput(form, formerr, 'wifissid', 'SSID name', 'internet') }}
-{{ lib.forminput(form, formerr, 'wifipower', 'Transmit Power', 'high, low') }}
-{{ lib.forminput(form, formerr, 'wifichannel', 'Channel', '11') }}
-
-<legend>Network Address</legend>
-{{ lib.forminput(form, formerr, 'ipv4addr', 'IPv4 Address', '0.0.0.0') }}
-{{ lib.forminput(form, formerr, 'ipv4netmask', 'Netmask', '255.255.0.0') }}
-{{ lib.forminput(form, formerr, 'ipv4gateway', 'Gateway IP Address', '0.0.0.0') }}
-
-<legend>DHCP Server</legend>
-{{ lib.forminput(form, formerr, 'dhcpbase', 'DHCP Range Base', '192.168.1.100') }}
-{{ lib.forminput(form, formerr, 'dhcptop', 'DHCP Range Top', '192.168.1.200') }}
-{{ lib.forminput(form, formerr, 'dhcptime', 'Lease Time', '12h') }}
-
-<div class="pull-right">
-<a href="."><button class="btn" type="button">Reset</button></a>
-<button type="submit" class="btn btn-primary" type="button">
-Save</button>
-</div>
-</form>
-{% endif %}
-
-{% endblock %}