Commit 9fbc6a2b authored by Vladislav Rykov's avatar Vladislav Rykov
Browse files

new application view changed

parent dfecfeec
...@@ -231,10 +231,14 @@ def dev_data(): ...@@ -231,10 +231,14 @@ def dev_data():
last = data.get_last_n(session['appkey'], session['devid'], 10) last = data.get_last_n(session['appkey'], session['devid'], 10)
count = data.get_count(session['appkey'], session['devid']) count = data.get_count(session['appkey'], session['devid'])
last_ctr = 10
if count[1][0] < 10:
last_ctr = count[1][0]
#print(last) #print(last)
#print(count) #print(count)
if count[1][0] > 0: if count[1][0] > 0:
return render_template('dev-data.html', data=last[1], total=count[1][0]) return render_template('dev-data.html', data=last[1], total=count[1][0], lastctr=last_ctr, devname=session['devname'])
else: else:
return render_template('dev-data.html') return render_template('dev-data.html')
......
...@@ -6,8 +6,13 @@ ...@@ -6,8 +6,13 @@
<div class="row"> <div class="row">
<div class="col-md-6 col-md-offset-3"> <div class="col-md-6 col-md-offset-3">
<div class="panel panel-success">
<div class="panel-heading">
<h2><center> {{ devname }} data </center></h2>
</div>
<div class="panel-body">
{% if data %} {% if data %}
<p>Last messages:</p> <p>Last {{ lastctr }} messages:</p>
<table class="table"> <table class="table">
<thead> <thead>
...@@ -24,11 +29,13 @@ ...@@ -24,11 +29,13 @@
</tbody> </tbody>
</table> </table>
<p>Total: {{ total }} messages.</p> <p>Total: <strong>{{ total }}</strong> messages.</p>
<center>
<a href="/data-csv"><button type="submit" class="btn btn-primary">Download CSV</button></a> <a href="/data-csv"><button type="submit" class="btn btn-primary">Download CSV</button></a>
</center>
{% else %} {% else %}
<p>Device have not sent any data yet.</p> <h3>Device have not sent any data yet.</h3>
{% endif %} {% endif %}
</div> </div>
</div> </div>
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
<div class="row"> <div class="row">
<div class="col-md-6 col-md-offset-3"> <div class="col-md-6 col-md-offset-3">
<div class="panel panel-success"> <div class="panel panel-info">
<div class="panel-heading"> <div class="panel-heading">
<center><h2> {{ dev[0] }} </h2></center> <center><h2> {{ dev[0] }} </h2></center>
</div> </div>
......
...@@ -21,15 +21,18 @@ ...@@ -21,15 +21,18 @@
<a class="navbar-brand" href="/">HPC&A IoT Server</a> <a class="navbar-brand" href="/">HPC&A IoT Server</a>
</div> </div>
<div id="navbar" class="collapse navbar-collapse"> <div id="navbar" class="collapse navbar-collapse">
<ul class="nav navbar-nav"> <ul class="nav navbar-nav navbar-left">
<li><a href="/">Home</a></li> <li><a href="/">Home</a></li>
{% if session['name'] %} {% if not session['name'] %}
<li><a href="/logout">Logout</a></li>
{% else %}
<li><a href="/login">Login</a></li> <li><a href="/login">Login</a></li>
<li><a href="/signup">Signup</a></li> <li><a href="/signup">Signup</a></li>
{% endif %} {% endif %}
</ul> </ul>
{% if session['name'] %}
<ul class="nav navbar-nav navbar-right">
<li><a href="/logout">Logout</a></li>
</ul>
{% endif %}
</div><!--/.nav-collapse --> </div><!--/.nav-collapse -->
</div> </div>
</nav> </nav>
......
...@@ -6,15 +6,18 @@ ...@@ -6,15 +6,18 @@
<div class="row"> <div class="row">
<div class="col-md-6 col-md-offset-3"> <div class="col-md-6 col-md-offset-3">
<h2> New application </h2>
<br><br>
<form action="app" method="post"> <form action="app" method="post">
<div class="form-group"> <div class="form-group">
<label>Name:</label><br> <label>Name:</label><br>
<input type="text" id="appname" name="appname"><br> <input type="text" class="form-control" id="appname" name="appname"><br>
</div> </div>
<div class="form-group"> <div class="form-group">
<label>Description:</label><br> <label>Description:</label><br>
<textarea id="appdesc" name="appdesc" cols="40" rows="5"></textarea> <textarea id="appdesc" class="form-control" name="appdesc" rows="5"></textarea>
</div> </div>
<br>
<div class="form-group"> <div class="form-group">
<button type="submit" class="btn btn-primary">Create</button> <button type="submit" class="btn btn-primary">Create</button>
</div> </div>
......
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