Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Vladislav Rykov
THSO.server
Commits
9fbc6a2b
Commit
9fbc6a2b
authored
Apr 15, 2020
by
Vladislav Rykov
Browse files
new application view changed
parent
dfecfeec
Changes
5
Hide whitespace changes
Inline
Side-by-side
server.py
View file @
9fbc6a2b
...
...
@@ -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'
)
...
...
templates/dev-data.html
View file @
9fbc6a2b
...
...
@@ -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>
...
...
templates/dev.html
View file @
9fbc6a2b
...
...
@@ -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>
...
...
templates/layout.html
View file @
9fbc6a2b
...
...
@@ -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>
...
...
templates/new-app.html
View file @
9fbc6a2b
...
...
@@ -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>
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment