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
ff1eb0bb
Commit
ff1eb0bb
authored
Apr 15, 2020
by
Vladislav Rykov
Browse files
device no data fixed
parent
410fcbe1
Changes
2
Show whitespace changes
Inline
Side-by-side
server.py
View file @
ff1eb0bb
...
@@ -22,7 +22,7 @@ def index():
...
@@ -22,7 +22,7 @@ def index():
apps
=
ah
.
get_list
(
session
[
'name'
].
encode
(
'utf-8'
))
apps
=
ah
.
get_list
(
session
[
'name'
].
encode
(
'utf-8'
))
session
.
pop
(
'appkey'
,
None
)
session
.
pop
(
'appkey'
,
None
)
print
(
'apps: '
,
apps
)
#
print('apps: ', apps)
if
apps
[
0
]:
if
apps
[
0
]:
return
render_template
(
'index.html'
,
apps
=
apps
[
1
])
return
render_template
(
'index.html'
,
apps
=
apps
[
1
])
else
:
else
:
...
@@ -102,7 +102,7 @@ def app():
...
@@ -102,7 +102,7 @@ def app():
app
=
ah
.
get
(
session
[
'appkey'
])
app
=
ah
.
get
(
session
[
'appkey'
])
devs
=
dh
.
get_list
(
app
[
1
][
1
])
devs
=
dh
.
get_list
(
app
[
1
][
1
])
print
(
'devs : '
,
devs
)
#
print('devs : ', devs)
return
render_template
(
'app.html'
,
app
=
app
[
1
],
devs
=
devs
[
1
])
return
render_template
(
'app.html'
,
app
=
app
[
1
],
devs
=
devs
[
1
])
else
:
else
:
if
request
.
form
[
'appname'
]
==
''
:
if
request
.
form
[
'appname'
]
==
''
:
...
@@ -147,7 +147,7 @@ def new_dev():
...
@@ -147,7 +147,7 @@ def new_dev():
dh
=
dd
.
DeviceDao
()
dh
=
dd
.
DeviceDao
()
dev_list
=
dh
.
get_list
(
session
[
'appkey'
])
dev_list
=
dh
.
get_list
(
session
[
'appkey'
])
print
(
'dev list : '
,
dev_list
)
#
print('dev list : ', dev_list)
if
not
dev_list
[
0
]:
if
not
dev_list
[
0
]:
return
render_template
(
'add-dev.html'
,
feedback
=
dev_list
[
1
])
return
render_template
(
'add-dev.html'
,
feedback
=
dev_list
[
1
])
...
@@ -227,8 +227,10 @@ def dev_data():
...
@@ -227,8 +227,10 @@ def dev_data():
#print(last)
#print(last)
#print(count)
#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
])
else
:
return
render_template
(
'dev-data.html'
)
@
server
.
route
(
'/data-csv'
)
@
server
.
route
(
'/data-csv'
)
def
data_csv
():
def
data_csv
():
...
...
templates/dev-data.html
View file @
ff1eb0bb
...
@@ -6,6 +6,7 @@
...
@@ -6,6 +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"
>
{% if data %}
<p>
Last 5 messages:
</p>
<p>
Last 5 messages:
</p>
<table
class=
"table"
>
<table
class=
"table"
>
...
@@ -26,6 +27,9 @@
...
@@ -26,6 +27,9 @@
<p>
Total: {{ total }} messages.
</p>
<p>
Total: {{ total }} messages.
</p>
<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>
{% else %}
<p>
Device have not sent any data yet.
</p>
{% endif %}
</div>
</div>
</div>
</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