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():
last = data.get_last_n(session['appkey'], session['devid'], 10)
count = data.get_count(session['appkey'], session['devid'])
last_ctr = 10
if count[1][0] < 10:
last_ctr = count[1][0]
#print(last)
#print(count)
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:
return render_template('dev-data.html')
......
......@@ -6,30 +6,37 @@
<div class="row">
<div class="col-md-6 col-md-offset-3">
{% if data %}
<p>Last messages:</p>
<div class="panel panel-success">
<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">
<thead>
<th>Time</th>
<th>Content</th>
</thead>
<tbody>
{% for d in data %}
<tr>
<th> {{ d[1] }} </th>
<th> {{ d[2] }} </th>
</tr>
{% endfor %}
</tbody>
</table>
<p>Total: {{ total }} messages.</p>
<a href="/data-csv"><button type="submit" class="btn btn-primary">Download CSV</button></a>
{% else %}
<p>Device have not sent any data yet.</p>
{% endif %}
<table class="table">
<thead>
<th>Time</th>
<th>Content</th>
</thead>
<tbody>
{% for d in data %}
<tr>
<th> {{ d[1] }} </th>
<th> {{ d[2] }} </th>
</tr>
{% endfor %}
</tbody>
</table>
<p>Total: <strong>{{ total }}</strong> messages.</p>
<center>
<a href="/data-csv"><button type="submit" class="btn btn-primary">Download CSV</button></a>
</center>
{% else %}
<h3>Device have not sent any data yet.</h3>
{% endif %}
</div>
</div>
......
......@@ -6,7 +6,7 @@
<div class="row">
<div class="col-md-6 col-md-offset-3">
<div class="panel panel-success">
<div class="panel panel-info">
<div class="panel-heading">
<center><h2> {{ dev[0] }} </h2></center>
</div>
......
......@@ -21,15 +21,18 @@
<a class="navbar-brand" href="/">HPC&A IoT Server</a>
</div>
<div id="navbar" class="collapse navbar-collapse">
<ul class="nav navbar-nav">
<li><a href="/">Home</a></li>
{% if session['name'] %}
<li><a href="/logout">Logout</a></li>
{% else %}
<li><a href="/login">Login</a></li>
<ul class="nav navbar-nav navbar-left">
<li><a href="/">Home</a></li>
{% if not session['name'] %}
<li><a href="/login">Login</a></li>
<li><a href="/signup">Signup</a></li>
{% endif %}
</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>
......
......@@ -6,15 +6,18 @@
<div class="row">
<div class="col-md-6 col-md-offset-3">
<h2> New application </h2>
<br><br>
<form action="app" method="post">
<div class="form-group">
<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 class="form-group">
<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>
<br>
<div class="form-group">
<button type="submit" class="btn btn-primary">Create</button>
</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