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
f557369d
Commit
f557369d
authored
Oct 08, 2020
by
Vladislav Rykov
Browse files
device buttons in application view made clickable
parent
a8aee891
Changes
7
Hide whitespace changes
Inline
Side-by-side
app/app.log
View file @
f557369d
...
@@ -10,3 +10,4 @@
...
@@ -10,3 +10,4 @@
[2020-10-07 17:18:50,561] INFO in views: Logged in superuser admin
[2020-10-07 17:18:50,561] INFO in views: Logged in superuser admin
[2020-10-07 17:19:21,368] INFO in views: Logged in superuser admin
[2020-10-07 17:19:21,368] INFO in views: Logged in superuser admin
[2020-10-07 19:11:04,501] INFO in views: superuser admin added new device testgeo for application 8cc6f4b1
[2020-10-07 19:11:04,501] INFO in views: superuser admin added new device testgeo for application 8cc6f4b1
[2020-10-07 22:22:21,007] INFO in views: Logged in superuser admin
app/app/__pycache__/views.cpython-37.pyc
View file @
f557369d
No preview for this file type
app/app/templates/general_layout.html
View file @
f557369d
<!--
<!--
=========================================================
=========================================================
* Argon
D
as
hboard
- v1.1.2
* Argon
B
as
e
- v1.1.2
=========================================================
=========================================================
* Product Page: https://www.creative-tim.com/product/argon-dashboard
* Product Page: https://www.creative-tim.com/product/argon-dashboard
...
...
app/app/templates/layout.html
deleted
100644 → 0
View file @
a8aee891
<!DOCTYPE html>
<html>
<head>
<meta
charset=
"utf-8"
/>
<meta
http-equiv=
"X-UA-Compatible"
content=
"IE-edge"
/>
<title>
{% block title %} {% endblock %}
</title>
<meta
name=
"viewport"
content=
"with-device-width, initial-scale-1"
/>
<link
rel=
"stylesheet"
type=
"text/css"
media=
"screen"
href=
"https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css"
/>
<link
rel=
"stylesheet"
type=
"text/css"
href=
"{{ url_for('static', filename='css/custom.css') }}"
/>
{% block head %}{% endblock %}
</head>
<body>
<nav
class=
"navbar navbar-inverse"
>
<div
class=
"container"
>
<div
class=
"navbar-header"
>
<button
type=
"button"
class=
"navbar-toggle collapsed"
data-toggle=
"collapse"
data-target=
"#navbar"
aria-expanded=
"false"
aria-controls=
"navbar"
>
<span
class=
"sr-only"
>
Toggle navigation
</span>
<span
class=
"icon-bar"
></span>
<span
class=
"icon-bar"
></span>
<span
class=
"icon-bar"
></span>
</button>
<a
class=
"navbar-brand"
href=
"/"
>
HPC
&
A IoT Server
</a>
</div>
<div
id=
"navbar"
class=
"collapse navbar-collapse"
>
<ul
class=
"nav navbar-nav navbar-left"
>
<li><a
href=
"/"
>
Home
</a></li>
{% if not session['name'] %}
<li><a
href=
"/login"
>
Login
</a></li>
{% if users_signup %}
<li><a
href=
"/signup"
>
Signup
</a></li>
{% endif %}
{% endif %}
</ul>
{% if session['name'] %}
<ul
class=
"nav navbar-nav navbar-right"
>
<li><a
href=
"/logout"
>
Logout
</a></li>
</ul>
<ul
class=
"nav navbar-nav navbar-right"
>
<li><a
href=
"/settings"
>
Settings
</a></li>
</ul>
{% endif %}
{% if session['role'] == 'admin' %}
<ul
class=
"nav navbar-nav navbar-right"
>
<li><a
href=
"/dashboard"
>
Dashboard
</a></li>
</ul>
{% endif %}
</div>
<!--/.nav-collapse -->
</div>
</nav>
<div
class=
"container"
>
{% block content %} {% endblock %}
<br><br>
<div
class=
"col-md-6 col-md-offset-3"
>
{% with messages = get_flashed_messages(with_categories=true) %}
{% if messages %}
{% for category, message in messages %}
<div
class=
"alert alert-{{ category }} alert-dismissiblei"
role=
"alert"
>
<button
type=
"button"
class=
"close"
data-dismiss=
"alert"
aria-label=
"Close"
>
<span
aria-hidden=
"true"
>
×
</span>
</button>
{{ message }}
</div>
{% endfor %}
{% endif %}
{% endwith %}
</div>
</div>
<!-- /.container -->
<script
src=
"https://code.jquery.com/jquery-3.3.1.slim.min.js"
></script>
<script
src=
"https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"
></script>
{% block script %} {% endblock %}
</body>
</html>
app/app/templates/logged_layout.html
View file @
f557369d
...
@@ -30,7 +30,7 @@
...
@@ -30,7 +30,7 @@
<a
class=
"nav-link"
href=
"#"
role=
"button"
data-toggle=
"dropdown"
aria-haspopup=
"true"
aria-expanded=
"false"
>
<a
class=
"nav-link"
href=
"#"
role=
"button"
data-toggle=
"dropdown"
aria-haspopup=
"true"
aria-expanded=
"false"
>
<div
class=
"media align-items-center"
>
<div
class=
"media align-items-center"
>
<span
class=
"avatar avatar-sm rounded-circle"
>
<span
class=
"avatar avatar-sm rounded-circle"
>
<img
alt=
"Image placeholder"
src=
"{{ url_for('static', filename='assets/img/theme/team-1-800x800.jpg') }}"
>
<!--
<img alt="Image placeholder" src="{{ url_for('static', filename='assets/img/theme/team-1-800x800.jpg') }}">
-->
</span>
</span>
</div>
</div>
</a>
</a>
...
@@ -38,24 +38,12 @@
...
@@ -38,24 +38,12 @@
<div
class=
" dropdown-header noti-title"
>
<div
class=
" dropdown-header noti-title"
>
<h6
class=
"text-overflow m-0"
>
Welcome!
</h6>
<h6
class=
"text-overflow m-0"
>
Welcome!
</h6>
</div>
</div>
<a
href=
"./examples/profile.html"
class=
"dropdown-item"
>
<a
href=
"/settings"
class=
"dropdown-item"
>
<i
class=
"ni ni-single-02"
></i>
<span>
My profile
</span>
</a>
<a
href=
"./examples/profile.html"
class=
"dropdown-item"
>
<i
class=
"ni ni-settings-gear-65"
></i>
<i
class=
"ni ni-settings-gear-65"
></i>
<span>
Settings
</span>
<span>
Settings
</span>
</a>
</a>
<a
href=
"./examples/profile.html"
class=
"dropdown-item"
>
<i
class=
"ni ni-calendar-grid-58"
></i>
<span>
Activity
</span>
</a>
<a
href=
"./examples/profile.html"
class=
"dropdown-item"
>
<i
class=
"ni ni-support-16"
></i>
<span>
Support
</span>
</a>
<div
class=
"dropdown-divider"
></div>
<div
class=
"dropdown-divider"
></div>
<a
href=
"
#!
"
class=
"dropdown-item"
>
<a
href=
"
/logout
"
class=
"dropdown-item"
>
<i
class=
"ni ni-user-run"
></i>
<i
class=
"ni ni-user-run"
></i>
<span>
Logout
</span>
<span>
Logout
</span>
</a>
</a>
...
@@ -82,35 +70,35 @@
...
@@ -82,35 +70,35 @@
</div>
</div>
<!-- Navigation -->
<!-- Navigation -->
<ul
class=
"navbar-nav"
>
<ul
class=
"navbar-nav"
>
<li
class=
"nav-item
active
"
>
<li
class=
"nav-item
{{ dashboard }}
"
>
<a
class=
"nav-link
active
"
href=
"/"
>
<a
class=
"nav-link
{{ dashboard }}
"
href=
"/"
>
<i
class=
"ni ni-tv-2 text-primary"
></i>
Dashboard
<i
class=
"ni ni-tv-2 text-primary"
></i>
Dashboard
</a>
</a>
</li>
</li>
<li
class=
"nav-item"
>
<li
class=
"nav-item
{{ applications }}
"
>
<a
class=
"nav-link "
href=
"/applications"
>
<a
class=
"nav-link
{{ applications }}
"
href=
"/applications"
>
<i
class=
"ni ni-air-baloon text-yellow"
></i>
Applications
<i
class=
"ni ni-air-baloon text-yellow"
></i>
Applications
</a>
</a>
</li>
</li>
<li
class=
"nav-item"
>
<li
class=
"nav-item
{{ map }}
"
>
<a
class=
"nav-link "
href=
"/map"
>
<a
class=
"nav-link
{{ map }}
"
href=
"/map"
>
<i
class=
"ni ni-map-big text-warning"
></i>
Map
<i
class=
"ni ni-map-big text-warning"
></i>
Map
</a>
</a>
</li>
</li>
{% if grant_view('admin', session['role']) %}
{% if grant_view('admin', session['role']) %}
<li
class=
"nav-item"
>
<li
class=
"nav-item
{{ administration }}
"
>
<a
class=
"nav-link "
href=
"/administration"
>
<a
class=
"nav-link
{{ administration }}
"
href=
"/administration"
>
<i
class=
"ni ni-briefcase-24 text-pink"
></i>
Administration
<i
class=
"ni ni-briefcase-24 text-pink"
></i>
Administration
</a>
</a>
</li>
</li>
<li
class=
"nav-item"
>
<li
class=
"nav-item"
{{
users
}}
>
<a
class=
"nav-link "
href=
"/administration/users"
>
<a
class=
"nav-link
{{ users }}
"
href=
"/administration/users"
>
<i
class=
"ni ni-single-02 text-info"
></i>
Users
<i
class=
"ni ni-single-02 text-info"
></i>
Users
</a>
</a>
</li>
</li>
{% endif %}
{% endif %}
<li
class=
"nav-item"
>
<li
class=
"nav-item
{{ settings }}
"
>
<a
class=
"nav-link "
href=
"/settings"
>
<a
class=
"nav-link
{{ settings }}
"
href=
"/settings"
>
<i
class=
"ni ni-settings-gear-65 text-grey"
></i>
Settings
<i
class=
"ni ni-settings-gear-65 text-grey"
></i>
Settings
</a>
</a>
</li>
</li>
...
...
app/app/templates/views/public/application.html
View file @
f557369d
...
@@ -105,13 +105,13 @@
...
@@ -105,13 +105,13 @@
{% if devs %}
{% if devs %}
{% for d in devs %}
{% for d in devs %}
<div
class=
"col-lg-3 col-md-6"
>
<div
class=
"col-lg-3 col-md-6"
>
<button
type=
"button"
class=
"btn-icon-clipboard"
data-clipboard-text=
"atom
"
title=
"{{ d[0] }}"
>
<button
type=
"button"
class=
"btn-icon-clipboard"
onclick=
"window.location.href='./{{ app[1] }}/device/{{ d[1] }}';
"
title=
"{{ d[0] }}"
>
<div>
<div>
<i
class=
"ni ni-atom"
></i>
<i
class=
"ni ni-atom"
></i>
<span>
<a
href=
"./{{ app[1] }}/device/{{ d[1] }}"
>
{{ d[0] }}
</
a></
span>
<span>
{{ d[0] }}
</span>
</div>
</div>
</button>
</button>
</div>
</div>
{% endfor %}
{% endfor %}
{% else %}
{% else %}
<div
class=
"col-lg-12 col-md-12"
>
<div
class=
"col-lg-12 col-md-12"
>
...
...
app/app/views.py
View file @
f557369d
...
@@ -35,7 +35,7 @@ def index():
...
@@ -35,7 +35,7 @@ def index():
last_activity
=
md
.
get_user_data_count_per_day
(
session
[
'name'
])[
1
][
0
]
last_activity
=
md
.
get_user_data_count_per_day
(
session
[
'name'
])[
1
][
0
]
info
=
[
created_apps
,
active_devices
,
total_activity
,
last_activity
]
info
=
[
created_apps
,
active_devices
,
total_activity
,
last_activity
]
return
render_template
(
'views/public/dashboard.html'
,
info
=
info
)
return
render_template
(
'views/public/dashboard.html'
,
info
=
info
,
dashboard
=
"active"
)
@
app
.
route
(
'/register'
,
methods
=
[
'GET'
,
'POST'
])
@
app
.
route
(
'/register'
,
methods
=
[
'GET'
,
'POST'
])
...
@@ -107,7 +107,7 @@ def logout():
...
@@ -107,7 +107,7 @@ def logout():
def
applications
():
def
applications
():
apps
=
ad
.
get_list
(
session
[
'name'
])
apps
=
ad
.
get_list
(
session
[
'name'
])
return
render_template
(
'views/public/applications.html'
,
apps
=
apps
[
1
])
return
render_template
(
'views/public/applications.html'
,
apps
=
apps
[
1
]
,
applications
=
"active"
)
@
app
.
route
(
'/application/<appkey>'
)
@
app
.
route
(
'/application/<appkey>'
)
...
@@ -118,14 +118,14 @@ def application(appkey):
...
@@ -118,14 +118,14 @@ def application(appkey):
ap
[
5
]
=
misc
.
skey_b64_to_hex
(
ap
[
5
])
ap
[
5
]
=
misc
.
skey_b64_to_hex
(
ap
[
5
])
devs
=
dd
.
get_list
(
ap
[
1
])[
1
]
devs
=
dd
.
get_list
(
ap
[
1
])[
1
]
return
render_template
(
'views/public/application.html'
,
app
=
ap
,
devs
=
devs
)
return
render_template
(
'views/public/application.html'
,
app
=
ap
,
devs
=
devs
,
applications
=
"active"
)
@
app
.
route
(
'/new-application'
,
methods
=
[
'GET'
,
'POST'
])
@
app
.
route
(
'/new-application'
,
methods
=
[
'GET'
,
'POST'
])
@
decorators
.
restricted
(
'user'
)
@
decorators
.
restricted
(
'user'
)
def
application_create
():
def
application_create
():
if
request
.
method
==
'GET'
:
if
request
.
method
==
'GET'
:
return
render_template
(
'views/public/new-application.html'
)
return
render_template
(
'views/public/new-application.html'
,
applications
=
"active"
)
elif
request
.
method
==
'POST'
:
elif
request
.
method
==
'POST'
:
if
request
.
form
[
'appname'
]
==
''
:
if
request
.
form
[
'appname'
]
==
''
:
flash
(
'Application name cannot be empty.'
,
'danger'
)
flash
(
'Application name cannot be empty.'
,
'danger'
)
...
@@ -203,7 +203,7 @@ def application_device(appkey, devid):
...
@@ -203,7 +203,7 @@ def application_device(appkey, devid):
if
ld
[
0
]
and
ld
[
1
][
0
]
!=
[]:
if
ld
[
0
]
and
ld
[
1
][
0
]
!=
[]:
ltup
=
ld
[
1
][
0
][
1
]
ltup
=
ld
[
1
][
0
][
1
]
return
render_template
(
'views/public/device.html'
,
dev
=
dev
[
1
],
app
=
ap
[
1
],
ltup
=
ltup
,
total
=
cnt
[
1
][
0
],
table_max
=
MAX_PG_ENTRIES_DATA
)
return
render_template
(
'views/public/device.html'
,
dev
=
dev
[
1
],
app
=
ap
[
1
],
ltup
=
ltup
,
total
=
cnt
[
1
][
0
],
table_max
=
MAX_PG_ENTRIES_DATA
,
applications
=
"active"
)
@
app
.
route
(
'/application/<appkey>/add-device'
,
methods
=
[
'GET'
,
'POST'
])
@
app
.
route
(
'/application/<appkey>/add-device'
,
methods
=
[
'GET'
,
'POST'
])
...
@@ -213,7 +213,7 @@ def application_add_device(appkey):
...
@@ -213,7 +213,7 @@ def application_add_device(appkey):
if
request
.
method
==
'GET'
:
if
request
.
method
==
'GET'
:
ap
=
ad
.
get
(
appkey
)
ap
=
ad
.
get
(
appkey
)
dev_list
=
dd
.
get_list
(
appkey
)
dev_list
=
dd
.
get_list
(
appkey
)
return
render_template
(
'views/public/add-device.html'
,
app
=
ap
[
1
],
free_ids
=
misc
.
prep_id_range
(
dev_list
[
1
]),
models
=
ddm
.
MODELS
)
return
render_template
(
'views/public/add-device.html'
,
app
=
ap
[
1
],
free_ids
=
misc
.
prep_id_range
(
dev_list
[
1
]),
models
=
ddm
.
MODELS
,
applications
=
"active"
)
elif
request
.
method
==
'POST'
:
elif
request
.
method
==
'POST'
:
if
dd
.
check_devid
(
appkey
,
request
.
form
[
'devid'
]):
if
dd
.
check_devid
(
appkey
,
request
.
form
[
'devid'
]):
ddmin
=
ddm
.
extract
(
request
)
ddmin
=
ddm
.
extract
(
request
)
...
@@ -281,7 +281,7 @@ def application_device_configuration(appkey, devid):
...
@@ -281,7 +281,7 @@ def application_device_configuration(appkey, devid):
ack
=
pm
[
3
]
ack
=
pm
[
3
]
config_list
.
append
((
config_id
,
config_args
,
ack
,
pm
[
2
]))
config_list
.
append
((
config_id
,
config_args
,
ack
,
pm
[
2
]))
return
render_template
(
'views/public/device-configuration.html'
,
dev
=
dev
,
app
=
ap
,
config_list
=
config_list
)
return
render_template
(
'views/public/device-configuration.html'
,
dev
=
dev
,
app
=
ap
,
config_list
=
config_list
,
applications
=
"active"
)
elif
request
.
method
==
'POST'
:
elif
request
.
method
==
'POST'
:
base64_args
=
misc
.
pend_base64_encode
(
request
.
form
[
'arg'
],
request
.
form
[
'confid'
])
base64_args
=
misc
.
pend_base64_encode
(
request
.
form
[
'arg'
],
request
.
form
[
'confid'
])
res
=
pend
.
create
(
appkey
,
devid
,
base64_args
)
res
=
pend
.
create
(
appkey
,
devid
,
base64_args
)
...
@@ -429,7 +429,7 @@ def delete_account():
...
@@ -429,7 +429,7 @@ def delete_account():
if
not
res
[
0
]:
if
not
res
[
0
]:
app
.
logger
.
error
(
'%s %s failed to delete the account - %s'
,
session
[
'role'
],
session
[
'name'
],
res
[
1
])
app
.
logger
.
error
(
'%s %s failed to delete the account - %s'
,
session
[
'role'
],
session
[
'name'
],
res
[
1
])
flash
(
'Error: {}'
.
format
(
res
[
1
]),
'danger'
)
flash
(
'Error: {}'
.
format
(
res
[
1
]),
'danger'
)
return
render_template
(
'views/public/settings.html'
,
user
=
session
[
'name'
])
return
render_template
(
'views/public/settings.html'
,
user
=
session
[
'name'
]
,
settings
=
"active"
)
else
:
else
:
app
.
logger
.
warning
(
'%s %s deleted the account'
,
session
[
'role'
],
session
[
'name'
])
app
.
logger
.
warning
(
'%s %s deleted the account'
,
session
[
'role'
],
session
[
'name'
])
flash
(
'User {} was deleted'
.
format
(
request
.
args
.
get
(
'name'
)),
'success'
)
flash
(
'User {} was deleted'
.
format
(
request
.
args
.
get
(
'name'
)),
'success'
)
...
@@ -440,7 +440,7 @@ def delete_account():
...
@@ -440,7 +440,7 @@ def delete_account():
@
decorators
.
restricted
(
'user'
)
@
decorators
.
restricted
(
'user'
)
def
settings
():
def
settings
():
if
request
.
method
==
'GET'
:
if
request
.
method
==
'GET'
:
return
render_template
(
'views/public/settings.html'
,
user
=
session
[
'name'
])
return
render_template
(
'views/public/settings.html'
,
user
=
session
[
'name'
]
,
settings
=
"active"
)
else
:
else
:
if
request
.
form
[
'name'
]
!=
session
[
'name'
]:
if
request
.
form
[
'name'
]
!=
session
[
'name'
]:
res
=
ud
.
update_name
(
session
[
'name'
],
request
.
form
[
'name'
])
res
=
ud
.
update_name
(
session
[
'name'
],
request
.
form
[
'name'
])
...
...
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