peach-workspace/peach-web/templates/network_detail.html.tera

77 lines
4.3 KiB
Plaintext

{%- extends "nav" -%}
{%- block card -%}
{%- if wlan_networks -%}
{%- for ssid, ap in wlan_networks -%}
{# select only the access point we are interested in #}
{%- if ssid == selected %}
<!-- NETWORK CARD -->
<div class="card center">
<!-- NETWORK INFO BOX -->
<div class="two-grid capsule{% if ssid == wlan_ssid %} success-border{% endif %}" title="PeachCloud network mode and status">
<!-- left column -->
<!-- NETWORK STATUS ICON -->
<div class="grid-column-1">
<img id="wifiIcon" class="center icon" src="/icons/wifi.svg" alt="WiFi icon">
<label class="center label-small font-gray" for="wifiIcon" title="Access Point Status">{% if ssid == wlan_ssid %}CONNECTED{% elif ap.state == "Available" %}AVAILABLE{% else %}NOT IN RANGE{% endif %}</label>
</div>
<!-- right column -->
<!-- NETWORK DETAILED INFO -->
<div class="grid-column-2">
<label class="label-small font-gray" for="netSsid" title="WiFi network SSID">SSID</label>
<p id="netSsid" class="card-text" title="SSID">{{ ssid }}</p>
<label class="label-small font-gray" for="netSec" title="Security protocol">SECURITY</label>
<p id="netSec" class="card-text" title="Security protocol in use by {{ ssid }}">{% if ap.detail %}{% if ap.detail.protocol != "" %}{{ ap.detail.protocol }}{% else %}None{% endif %}{% else %}Unknown{% endif %}</p>
<label class="label-small font-gray" for="netSig" title="Signal Strength">SIGNAL</label>
<p id="netSig" class="card-text" title="Signal strength of WiFi access point">{% if ap.signal %}{{ ap.signal }}%{% else %}Unknown{% endif %}</p>
</div>
</div>
<!-- BUTTONS -->
<div class="card-container" style="padding-top: 0;">
<div id="buttonDiv">
{%- if wlan_ssid == selected -%}
<form id="wifiDisconnect" action="/network/wifi/disconnect" method="post">
<!-- hidden element: allows ssid to be sent in request -->
<input id="disconnectSsid" name="ssid" type="text" value="{{ ssid }}" style="display: none;">
<input id="disconnectWifi" class="button button-warning center" title="Disconnect from Network" type="submit" value="Disconnect">
</form>
{%- endif -%}
{%- if saved_aps -%}
{# Loop through the list of AP's with saved credentials #}
{%- for ap in saved_aps -%}
{# If the selected access point appears in the list, #}
{# display the Modify and Forget buttons. #}
{%- if ap.ssid == selected -%}
{# Set 'in_list' to true to allow correct Add button display #}
{% set_global in_list = true %}
{%- if wlan_ssid != selected and ap.state == "Available" -%}
<form id="wifiConnect" action="/network/wifi/connect" method="post">
<!-- hidden element: allows ssid to be sent in request -->
<input id="connectSsid" name="ssid" type="text" value="{{ ap.ssid }}" style="display: none;">
<input id="connectWifi" class="button button-primary center" title="Connect to Network" type="submit" value="Connect">
</form>
{%- endif -%}
<a class="button button-primary center" href="/network/wifi/modify?ssid={{ ssid }}">Modify</a>
<form id="wifiForget" action="/network/wifi/forget" method="post">
<!-- hidden element: allows ssid to be sent in request -->
<input id="forgetSsid" name="ssid" type="text" value="{{ ap.ssid }}" style="display: none;">
<input id="forgetWifi" class="button button-warning center" title="Forget Network" type="submit" value="Forget">
</form>
{%- endif -%}
{%- endfor -%}
{%- endif -%}
{%- if in_list == false -%}
{# Display the Add button if AP creds not already in saved networks list #}
<a class="button button-primary center" href="/network/wifi/add?ssid={{ ssid }}">Add</a>
{%- endif -%}
<a class="button button-secondary center" href="/network/wifi" title="Cancel">Cancel</a>
</div>
<!-- FLASH MESSAGE -->
{% include "snippets/flash_message" %}
</div>
</div>
<script type="text/javascript" src="/js/network_detail.js"></script>
{%- endif -%}
{%- endfor -%}
{%- endif -%}
{%- endblock card -%}