aboutsummaryrefslogtreecommitdiffstats
path: root/torouterui/templates/lib.html
blob: 6ac5e12381602c853c2b2dbe2f7cd0fc85588198 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84


{% 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 %}