From 42725426ec02d359b67cd8d665afe17882d38958 Mon Sep 17 00:00:00 2001 From: ficus Date: Sat, 15 Sep 2012 19:46:49 +0200 Subject: more WIP --- templates/base.html | 12 +++--- templates/home.html | 96 ++++++++++++++++++++++++++++++++---------------- templates/lan.html | 32 ++++++++++++++++ templates/lib.html | 65 ++++++++++++++++++++++++++------ templates/processes.html | 6 +-- templates/tor.html | 19 ++++++++++ templates/wan.html | 35 ++++++++++++++++++ templates/wifi.html | 38 +++++++++++++++++++ 8 files changed, 250 insertions(+), 53 deletions(-) create mode 100644 templates/lan.html create mode 100644 templates/tor.html create mode 100644 templates/wifi.html (limited to 'templates') diff --git a/templates/base.html b/templates/base.html index a2c1407..4c15c73 100644 --- a/templates/base.html +++ b/templates/base.html @@ -37,13 +37,12 @@
  • {{name}}
  • {%- endmacro %} {{ pagelink("/", "Status") }} - {{ pagelink("/admin/", "Administration") }} {{ pagelink("/reboot/", "Reboot...") }} - {{ pagelink("/wan/", "Upstream") }} - {{ pagelink("/lan/", "Local") }} - {{ pagelink("/wireless/", "Wireless") }} - {{ pagelink("/tor/", "Tor") }} + {{ pagelink("/wan/", "Upstream Ethernet") }} + {{ pagelink("/lan/", "Local Ethernet") }} + {{ pagelink("/wifi/", "WiFi") }} + {{ pagelink("/tor/", "Tor Network") }} {{ pagelink("/logs/", "Logs") }} {{ pagelink("/processes/", "Processes") }} @@ -51,8 +50,8 @@
    - {% with messages = get_flashed_messages(with_categories=true) %} {% if messages %} + {{ mesages }} {% for category, message in messages %}
    @@ -63,7 +62,6 @@
    {% endfor %} {% endif %} - {% endwith %} {% block body %}{% endblock %}
    diff --git a/templates/home.html b/templates/home.html index 30c328e..fa2ed2b 100644 --- a/templates/home.html +++ b/templates/home.html @@ -1,39 +1,71 @@ {% import "lib.html" as lib %} {% extends "base.html" %} {% block body %} -

    System

    - - - - -
    Host Name - {{ status.system.hostname }} -
    Current Time - {{ status.system.current_time }} -
    System Uptime - {{ status.system.uptime }} -
    -

    WAN

    -{% if not status.wan %} -Upstream ethernet interface hardware not detected at all! -{% else %} -{{ lib.ifstatus(status.wan) }} -{% endif %} - -

    LAN

    -{% if not status.lan %} -Local network ethernet interface hardware not detected at all! -{% else %} -{{ lib.ifstatus(status.lan) }} -{% endif %} - -

    Wireless

    -{% if not status.wireless %} -Wireless interface hardware not detected at all! -{% else %} -{{ lib.ifstatus(status.wireless) }} -{% endif %} +
    +
    +

    System

    + + + + +
    Host Name + {{ status.system.hostname }} +
    Current Time + {{ status.system.current_time }} +
    System Uptime + {{ status.system.uptime }} +
    +
    +
    +

    Resources

    +
      +
    • + CPU Load{{status.resources.cpu_load}} / {{status.resources.cpu_cores}} cores +
      +
      +
      +
    • +
    • RAM Usage{{status.resources.ram_used}} / {{status.resources.ram_avail}} +
      +
      +
      +
    • +
    • Primary Disk Space{{status.resources.disk_used}} / {{status.resources.disk_avail}} +
      +
      +
      +
    • +
    +
    +
    +
    +
    +

    WAN

    + {{ lib.ifstatus(status.wan) }} +
    +
    +

    LAN

    + {{ lib.ifstatus(status.lan) }} +
    +
    +
    +
    +

    WiFi

    + {{ lib.ifstatus(status.wifi) }} +
    +
    +

    Tor

    + + +
    Status + + {{ status.tor.state }} + +
    +
    +
    {% endblock %} diff --git a/templates/lan.html b/templates/lan.html new file mode 100644 index 0000000..09bcf0a --- /dev/null +++ b/templates/lan.html @@ -0,0 +1,32 @@ +{% import "lib.html" as lib %} +{% extends "base.html" %} +{% block body %} + +
    +Local Ethernet Configuration + +{% if not status.lan %} +Could not find the local ethernet hardware device! +{% else %} + +{{ lib.formcheckbox(form, formerr, 'ipv4enable', 'Enable this interface', 'true') }} + +Address Configuration +{{ 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') }} + +DHCP Configuration +{{ 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') }} + +
    + + +
    +
    +{% endif %} + +{% endblock %} diff --git a/templates/lib.html b/templates/lib.html index 33534da..6ac5e12 100644 --- a/templates/lib.html +++ b/templates/lib.html @@ -1,41 +1,84 @@ + {% macro ifstatus(ifstatus) -%} - +{% if not ifstatus %} + +Network hardware not detected at all! + +{% else %} +
    + + + +
    Interface Name - {{ ifstatus.ifname }} + {{ ifstatus.ifname }}
    Status - + {{ ifstatus.state }}
    MAC Address - {{ ifstatus.mac }} + {{ ifstatus.mac }}
    IPv4 Addresses - + {% for addr in ifstatus.ipv4addrs %} {{ addr.addr }}/{{ addr.prefix}} ({{ addr.scope }})
    - {% endfor %} + {% endfor %}
    IPv6 Addresses - + {% for addr in ifstatus.ipv6addrs %} {{ addr.addr }}/{{ addr.prefix}} ({{ addr.scope }})
    - {% endfor %} + {% endfor %}
    + {% if ifstatus.radio_state %} +
    Radio State + {{ ifstatus.radio_state }} +
    SSID + {{ ifstatus.ssid }} +
    Frequency + {{ ifstatus.freq }} +
    Signal Strength + {{ ifstatus.signal_dbm }} + {% endif %}
    +{% endif %} {%- endmacro %} + {% macro logbox(name, contents) -%}

    {{name}}

    {% if contents == None %} Access to {{name}} was denied, or file did not exist. {% else %} - -
    +
    +
     {{ contents }}
     
    +
    {% endif%} {%- endmacro %} + + +{% macro forminput(form, formerr, name, title, placeholder) -%} +
    + +
    + + {% if formerr[name] %} + {{ formerr[name] }} + {% endif %} +
    +
    +{%- endmacro %} + +{% macro formcheckbox(form, formerr, name, title, value) -%} + +{% endmacro %} diff --git a/templates/processes.html b/templates/processes.html index c911b0a..2e35162 100644 --- a/templates/processes.html +++ b/templates/processes.html @@ -8,12 +8,12 @@ PID %CPU %MEM - Status Code + Status Started Time Command {% for proc in process_list %} - + {{ proc.user }} {{ proc.pid}} {{ proc.perc_cpu }} @@ -21,7 +21,7 @@ {{ proc.status_code }} {{ proc.started }} {{ proc.time }} - {{ proc.command }} +
    {{ proc.command }}
    {% endfor %} diff --git a/templates/tor.html b/templates/tor.html new file mode 100644 index 0000000..a1f30dc --- /dev/null +++ b/templates/tor.html @@ -0,0 +1,19 @@ +{% import "lib.html" as lib %} +{% extends "base.html" %} +{% block body %} + +
    +Tor Network Configuration + +{{ 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') }} + +
    + + +
    +
    + +{% endblock %} diff --git a/templates/wan.html b/templates/wan.html index e69de29..2da2733 100644 --- a/templates/wan.html +++ b/templates/wan.html @@ -0,0 +1,35 @@ +{% import "lib.html" as lib %} +{% extends "base.html" %} +{% block body %} + +
    +Upstream Ethernet Configuration + + + + + +{{ 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') }} + + + +
    + + +
    +
    + + +{% endblock %} diff --git a/templates/wifi.html b/templates/wifi.html new file mode 100644 index 0000000..3e41788 --- /dev/null +++ b/templates/wifi.html @@ -0,0 +1,38 @@ +{% import "lib.html" as lib %} +{% extends "base.html" %} +{% block body %} + +
    +WiFi Configuration + +{% if not status.wifi %} +Could not find the WiFi hardware device! +{% else %} + +{{ lib.formcheckbox(form, formerr, 'wifienable', 'Enable the radio', 'true') }} +{{ lib.formcheckbox(form, formerr, 'torifylanenable', 'Transparently "Tor-ify" this network interface', 'true') }} + +Radio +{{ lib.forminput(form, formerr, 'wifissid', 'SSID name', 'internet') }} +{{ lib.forminput(form, formerr, 'wifipower', 'Transmit Power', 'high, low') }} +{{ lib.forminput(form, formerr, 'wifichannel', 'Channel', '11') }} + +Network Address +{{ 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') }} + +DHCP Server +{{ 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') }} + +
    + + +
    +
    +{% endif %} + +{% endblock %} -- cgit v1.2.3