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
cea4069e
Commit
cea4069e
authored
Oct 27, 2020
by
Vladislav Rykov
Browse files
gateway view added
parent
c36f04e9
Changes
4
Show whitespace changes
Inline
Side-by-side
app/app/__pycache__/views_admin.cpython-37.pyc
View file @
cea4069e
No preview for this file type
app/app/dao/gateway/gateway.py
View file @
cea4069e
...
...
@@ -13,9 +13,9 @@ def create(cur, name, gwid, protocol, desc, secure_key, telemetry_send_freq):
@
with_psql
def
get
(
cur
,
gwid
):
cur
.
execute
(
'SELECT row_to_json(r) FROM (SELECT * FROM gateways WHERE id = %s) r'
,
gwid
)
cur
.
execute
(
'SELECT row_to_json(r) FROM (SELECT * FROM gateways WHERE id = %s) r'
,
(
gwid
,)
)
return
(
True
,
cur
.
fetchone
()[
0
]
[
0
]
)
return
(
True
,
cur
.
fetchone
()[
0
])
@
with_psql
...
...
app/app/templates/views/admin/gateway.html
0 → 100644
View file @
cea4069e
{% extends 'logged_layout.html' %}
{% block title %} Administration - Gateways - {{ gw['id'] }} - HPC
&
A IoT {% endblock %}
{% block location %}
<a
class=
"h4 mb-0 text-white text-uppercase d-none d-lg-inline-block"
href=
"/administration"
>
Administration
</a>
<p
class=
"h4 mb-0 text-white text-uppercase d-none d-lg-inline-block"
>
-
</p>
<a
class=
"h4 mb-0 text-white text-uppercase d-none d-lg-inline-block"
href=
"/administration/gateways"
>
Gateways
</a>
<p
class=
"h4 mb-0 text-white text-uppercase d-none d-lg-inline-block"
>
-
</p>
<a
class=
"h4 mb-0 text-white text-uppercase d-none d-lg-inline-block"
href=
"/administration/gateway/{{ gw['id'] }}"
>
{{ gw['name'] }}
</a>
{% endblock %}
{% block body %}
<!-- Page content -->
<div
class=
"container-fluid mt--7"
>
<!-- Table -->
<div
class=
"row"
>
<div
class=
"col"
>
<div
class=
"card shadow"
>
<div
class=
"card-header bg-transparent"
>
<h3
class=
"mb-0"
>
Details
</h3>
</div>
<div
class=
"card-body"
>
<div
class=
"col-lg-12 col-md-6"
style=
"margin-bottom : 30px;"
>
<div
class=
"card"
style=
"margin-bottom : 15px;"
>
<div
class=
"card-body"
>
<h5
class=
"card-title"
>
Name
</h5>
<p
class=
"card-text"
>
{{ gw['name'] }}
</p>
</div>
</div>
<div
class=
"card"
style=
"margin-bottom : 15px;"
>
<div
class=
"card-body"
>
<h5
class=
"card-title"
>
ID
</h5>
<p
class=
"card-text"
>
{{ gw['id'] }}
</p>
</div>
</div>
<div
class=
"card"
style=
"margin-bottom : 15px;"
>
<div
class=
"card-body"
>
<h5
class=
"card-title"
>
Protocol
</h5>
<p
class=
"card-text"
>
{{ gw['protocol'] }}
</p>
</div>
</div>
<div
class=
"card"
style=
"margin-bottom : 15px;"
>
<div
class=
"card-body"
>
<h5
class=
"card-title"
>
Description
</h5>
<p
class=
"card-text"
>
{{ gw['description'] }}
</p>
</div>
</div>
<div
class=
"card"
style=
"margin-bottom : 15px;"
>
<div
class=
"card-body"
>
<h5
class=
"card-title"
>
Secure Key
</h5>
<p
class=
"card-text"
id=
"secure_key"
>
{{ gw['secure_key'] }}
</p>
</div>
</div>
<div
class=
"card"
style=
"margin-bottom : 15px;"
>
<div
class=
"card-body"
>
<h5
class=
"card-title"
>
Telemetry Send Period
</h5>
<p
class=
"card-text"
>
{{ gw['telemetry_send_freq'] }}
</p>
</div>
</div>
<div
class=
"card"
style=
"margin-bottom : 15px;"
>
<div
class=
"card-body"
>
<h5
class=
"card-title"
>
Last Keep Alive
</h5>
<p
class=
"card-text"
>
{{ gw['last_keep_alive'] }}
</p>
</div>
</div>
<div
class=
"card"
style=
"margin-bottom : 15px;"
>
<div
class=
"card-body"
>
<h5
class=
"card-title"
>
Errors Count
</h5>
<p
class=
"card-text"
>
{{ gw['num_errors'] }}
</p>
</div>
</div>
<div
class=
"card"
style=
"margin-bottom : 15px;"
>
<div
class=
"card-body"
>
<h5
class=
"card-title"
>
Last Report
</h5>
<p
class=
"card-text"
>
{{ gw['last_report'] }}
</p>
</div>
</div>
</div>
<div
class=
"row"
style=
"margin-top: 30px;"
>
<div
class=
"col-lg-4"
>
</div>
<div
class=
"col-lg-4"
>
</div>
<div
class=
"col-lg-4"
>
<a
href=
"/administration/gateway/{{ gw['id'] }}/settings"
<
button
type=
"submit"
class=
"btn btn-primary btn-block"
>
Settings
</button></a>
</div>
</div>
</div>
</div>
</div>
</div>
{% endblock %}
{% block script %}
<script
type=
"text/javascript"
>
var
skey
=
document
.
getElementById
(
"
secure_key
"
).
innerHTML
;
var
fskey
=
"
{
"
;
for
(
var
i
=
2
;
i
<
skey
.
length
-
2
;
i
+=
2
)
{
fskey
+=
"
0x
"
+
(
skey
[
i
]
+
skey
[
i
+
1
])
+
"
,
"
;
}
fskey
+=
"
0x
"
+
skey
[
skey
.
length
-
2
]
+
skey
[
skey
.
length
-
1
]
+
"
}
"
;
$
(
"
#secure_key
"
).
text
(
fskey
);
</script>
{% endblock %}
app/app/views_admin.py
View file @
cea4069e
...
...
@@ -670,7 +670,7 @@ def administration_gateway(gwid):
devs_cnt
=
dd
.
get_count_all
()[
1
][
0
]
info
=
[
user_cnt
,
apps_cnt
,
devs_cnt
]
gw
s
=
gd
.
get
(
gwid
)[
1
]
gw
=
gd
.
get
(
gwid
)[
1
]
return
render_template
(
'views/admin/gateway.html'
,
utcnow
=
misc
.
get_utc
(),
info
=
info
,
gw
=
gw
)
...
...
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