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
3c375b76
Commit
3c375b76
authored
Oct 28, 2020
by
Vladislav Rykov
Browse files
logged layout changed including gateways link
parent
b9d157c6
Changes
4
Hide whitespace changes
Inline
Side-by-side
app/app/__pycache__/views_admin.cpython-37.pyc
View file @
3c375b76
No preview for this file type
app/app/templates/logged_layout.html
View file @
3c375b76
...
...
@@ -96,6 +96,11 @@
<i
class=
"ni ni-single-02 text-info"
></i>
Users
</a>
</li>
<li
class=
"nav-item"
{{
gateways
}}
>
<a
class=
"nav-link {{ gateways }} "
href=
"/administration/gateways"
>
<i
class=
"ni ni-compass-04 text-brown"
></i>
Gateways
</a>
</li>
{% endif %}
<li
class=
"nav-item {{ settings }}"
>
<a
class=
"nav-link {{ settings }}"
href=
"/settings"
>
...
...
app/app/templates/views/admin/gateways.html
View file @
3c375b76
...
...
@@ -92,7 +92,7 @@
{% for gw in gws %}
<tr
onclick=
"window.location='/administration/gateway/{{ gw["
id
"]
}}';"
>
<th>
{{ gw['name'] }}
</th>
<th>
{{ gw['protocol'] }}
</th>
<th>
{{
protocols[
gw['protocol']
]
}}
</th>
<th>
<span
class=
"badge badge-dot"
>
{% if (utcnow - gw['last_keep_alive']) > gw['telemetry_send_freq'] %}
<i
class=
"bg-danger"
></i>
connection-lost
...
...
app/app/views_admin.py
View file @
3c375b76
...
...
@@ -660,7 +660,7 @@ def administration_gateways():
gws
=
gd
.
get_all
()[
1
]
return
render_template
(
'views/admin/gateways.html'
,
utcnow
=
misc
.
get_utc
(),
info
=
info
,
gws
=
gws
)
return
render_template
(
'views/admin/gateways.html'
,
utcnow
=
misc
.
get_utc
(),
info
=
info
,
gws
=
gws
,
protocols
=
gwm
.
PROTOCOLS
,
gateways
=
"active"
)
@
app
.
route
(
'/administration/gateway/<gwid>'
,
methods
=
[
"GET"
,
"POST"
,
"DELETE"
])
...
...
@@ -674,14 +674,14 @@ def administration_gateway(gwid):
gw
=
gd
.
get
(
gwid
)[
1
]
gw
[
'secure_key'
]
=
misc
.
skey_b64_to_hex
(
gw
[
'secure_key'
]).
decode
(
'UTF-8'
)
return
render_template
(
'views/admin/gateway.html'
,
utcnow
=
misc
.
get_utc
(),
info
=
info
,
gw
=
gw
,
protocols
=
gwm
.
PROTOCOLS
)
return
render_template
(
'views/admin/gateway.html'
,
utcnow
=
misc
.
get_utc
(),
info
=
info
,
gw
=
gw
,
protocols
=
gwm
.
PROTOCOLS
,
gateways
=
"active"
)
@
app
.
route
(
'/administration/new-gateway'
,
methods
=
[
'GET'
,
'POST'
])
@
restricted
(
'admin'
)
def
administration_new_gateway
():
if
request
.
method
==
'GET'
:
return
render_template
(
'views/admin/new-gateway.html'
,
administration
=
"active"
,
protocols
=
gwm
.
PROTOCOLS
)
return
render_template
(
'views/admin/new-gateway.html'
,
administration
=
"active"
,
protocols
=
gwm
.
PROTOCOLS
,
gateways
=
"active"
)
elif
request
.
method
==
'POST'
:
secure_key
=
misc
.
gen_skey_b64
(
16
)
...
...
@@ -701,7 +701,7 @@ def administration_gateway_settings(gwid):
gw
=
gd
.
get
(
gwid
)[
1
]
gw
[
'secure_key'
]
=
misc
.
skey_b64_to_hex
(
gw
[
'secure_key'
]).
decode
(
'UTF-8'
)
return
render_template
(
'views/admin/gateway-settings.html'
,
utcnow
=
misc
.
get_utc
(),
gw
=
gw
,
protocols
=
gwm
.
PROTOCOLS
)
return
render_template
(
'views/admin/gateway-settings.html'
,
utcnow
=
misc
.
get_utc
(),
gw
=
gw
,
protocols
=
gwm
.
PROTOCOLS
,
gateways
=
"active"
)
elif
request
.
method
==
"POST"
:
res
=
gd
.
update
(
request
.
form
[
'gwname'
],
request
.
form
[
'gwid'
],
request
.
form
[
'gwprotocol'
],
request
.
form
[
'gwdesc'
],
request
.
form
[
'gwtelemetry'
])
if
not
res
[
0
]:
...
...
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