Commit 3c375b76 authored by Vladislav Rykov's avatar Vladislav Rykov
Browse files

logged layout changed including gateways link

parent b9d157c6
...@@ -96,6 +96,11 @@ ...@@ -96,6 +96,11 @@
<i class="ni ni-single-02 text-info"></i> Users <i class="ni ni-single-02 text-info"></i> Users
</a> </a>
</li> </li>
<li class="nav-item" {{ gateways }}>
<a class="nav-link {{ gateways }} " href="/administration/gateways">
<i class="ni ni-compass-04 text-brown"></i> Gateways
</a>
</li>
{% endif %} {% endif %}
<li class="nav-item {{ settings }}"> <li class="nav-item {{ settings }}">
<a class="nav-link {{ settings }}" href="/settings"> <a class="nav-link {{ settings }}" href="/settings">
......
...@@ -92,7 +92,7 @@ ...@@ -92,7 +92,7 @@
{% for gw in gws %} {% for gw in gws %}
<tr onclick="window.location='/administration/gateway/{{ gw["id"] }}';"> <tr onclick="window.location='/administration/gateway/{{ gw["id"] }}';">
<th> {{ gw['name'] }} </th> <th> {{ gw['name'] }} </th>
<th> {{ gw['protocol'] }} </th> <th> {{ protocols[gw['protocol']] }} </th>
<th> <span class="badge badge-dot"> <th> <span class="badge badge-dot">
{% if (utcnow - gw['last_keep_alive']) > gw['telemetry_send_freq'] %} {% if (utcnow - gw['last_keep_alive']) > gw['telemetry_send_freq'] %}
<i class="bg-danger"></i> connection-lost <i class="bg-danger"></i> connection-lost
......
...@@ -660,7 +660,7 @@ def administration_gateways(): ...@@ -660,7 +660,7 @@ def administration_gateways():
gws = gd.get_all()[1] gws = gd.get_all()[1]
return render_template('views/admin/gateways.html', utcnow=misc.get_utc(), info=info, gws=gws) return render_template('views/admin/gateways.html', utcnow=misc.get_utc(), info=info, gws=gws, protocols=gwm.PROTOCOLS, gateways="active")
@app.route('/administration/gateway/<gwid>', methods=["GET", "POST", "DELETE"]) @app.route('/administration/gateway/<gwid>', methods=["GET", "POST", "DELETE"])
...@@ -674,14 +674,14 @@ def administration_gateway(gwid): ...@@ -674,14 +674,14 @@ def administration_gateway(gwid):
gw = gd.get(gwid)[1] gw = gd.get(gwid)[1]
gw['secure_key'] = misc.skey_b64_to_hex(gw['secure_key']).decode('UTF-8') gw['secure_key'] = misc.skey_b64_to_hex(gw['secure_key']).decode('UTF-8')
return render_template('views/admin/gateway.html', utcnow=misc.get_utc(), info=info, gw=gw, protocols=gwm.PROTOCOLS) return render_template('views/admin/gateway.html', utcnow=misc.get_utc(), info=info, gw=gw, protocols=gwm.PROTOCOLS, gateways="active")
@app.route('/administration/new-gateway', methods=['GET', 'POST']) @app.route('/administration/new-gateway', methods=['GET', 'POST'])
@restricted('admin') @restricted('admin')
def administration_new_gateway(): def administration_new_gateway():
if request.method == 'GET': if request.method == 'GET':
return render_template('views/admin/new-gateway.html', administration="active", protocols=gwm.PROTOCOLS) return render_template('views/admin/new-gateway.html', administration="active", protocols=gwm.PROTOCOLS, gateways="active")
elif request.method == 'POST': elif request.method == 'POST':
secure_key = misc.gen_skey_b64(16) secure_key = misc.gen_skey_b64(16)
...@@ -701,7 +701,7 @@ def administration_gateway_settings(gwid): ...@@ -701,7 +701,7 @@ def administration_gateway_settings(gwid):
gw = gd.get(gwid)[1] gw = gd.get(gwid)[1]
gw['secure_key'] = misc.skey_b64_to_hex(gw['secure_key']).decode('UTF-8') gw['secure_key'] = misc.skey_b64_to_hex(gw['secure_key']).decode('UTF-8')
return render_template('views/admin/gateway-settings.html', utcnow=misc.get_utc(), gw=gw, protocols=gwm.PROTOCOLS) return render_template('views/admin/gateway-settings.html', utcnow=misc.get_utc(), gw=gw, protocols=gwm.PROTOCOLS, gateways="active")
elif request.method == "POST": elif request.method == "POST":
res = gd.update(request.form['gwname'], request.form['gwid'], request.form['gwprotocol'], request.form['gwdesc'], request.form['gwtelemetry']) res = gd.update(request.form['gwname'], request.form['gwid'], request.form['gwprotocol'], request.form['gwdesc'], request.form['gwtelemetry'])
if not res[0]: if not res[0]:
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment