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,30 +6,37 @@ ...@@ -6,30 +6,37 @@
<div class="row"> <div class="row">
<div class="col-md-6 col-md-offset-3"> <div class="col-md-6 col-md-offset-3">
{% if data %} <div class="panel panel-success">
<p>Last messages:</p> <div class="panel-heading">
<h2><center> {{ devname }} data </center></h2>
</div>
<div class="panel-body">
{% if data %}
<p>Last {{ lastctr }} messages:</p>
<table class="table"> <table class="table">
<thead> <thead>
<th>Time</th> <th>Time</th>
<th>Content</th> <th>Content</th>
</thead> </thead>
<tbody> <tbody>
{% for d in data %} {% for d in data %}
<tr> <tr>
<th> {{ d[1] }} </th> <th> {{ d[1] }} </th>
<th> {{ d[2] }} </th> <th> {{ d[2] }} </th>
</tr> </tr>
{% endfor %} {% endfor %}
</tbody> </tbody>
</table> </table>
<p>Total: {{ total }} messages.</p> <p>Total: <strong>{{ total }}</strong> messages.</p>
<a href="/data-csv"><button type="submit" class="btn btn-primary">Download CSV</button></a> <center>
{% else %} <a href="/data-csv"><button type="submit" class="btn btn-primary">Download CSV</button></a>
<p>Device have not sent any data yet.</p> </center>
{% endif %} {% else %}
<h3>Device have not sent any data yet.</h3>
{% 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> <li><a href="/login">Login</a></li>
{% else %}
<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