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
7515fd5d
Commit
7515fd5d
authored
Jun 07, 2020
by
Vladislav Rykov
Browse files
new admin urlpaths tested + admin view cards added
parent
bf0820b1
Changes
5
Hide whitespace changes
Inline
Side-by-side
app/app/__pycache__/views_admin.cpython-37.pyc
View file @
7515fd5d
No preview for this file type
app/app/templates/new/admin/user-add-device.html
View file @
7515fd5d
...
...
@@ -29,7 +29,7 @@
<h3
class=
"mb-0"
>
Add Device
</h3>
</div>
<div
class=
"card-body"
>
<form
action=
"/administration/
users/
{{ user }}/application/{{ app[1] }}/add-device"
method=
"post"
>
<form
action=
"/administration/{{ user }}/application/{{ app[1] }}/add-device"
method=
"post"
>
<div
class=
"form-group"
>
<label>
Name:
</label><br>
<input
type=
"text"
maxlength=
"30"
class=
"form-control"
id=
"devname"
name=
"devname"
required
><br>
...
...
app/app/templates/new/admin/user-application.html
View file @
7515fd5d
...
...
@@ -25,6 +25,11 @@
<h5
class=
"card-title text-uppercase text-muted mb-0"
>
Name
</h5>
<span
class=
"h2 font-weight-bold mb-0"
>
{{ app[0] }}
</span>
</div>
<div
class=
"col-auto"
>
<div
class=
"icon icon-shape bg-success text-white rounded-circle shadow"
>
<i
class=
"fas fa-cube"
></i>
</div>
</div>
</div>
</div>
</div>
...
...
@@ -37,6 +42,11 @@
<h5
class=
"card-title text-uppercase text-muted mb-0"
>
App-Key
</h5>
<span
class=
"h2 font-weight-bold mb-0"
>
{{ app[1] }}
</span>
</div>
<div
class=
"col-auto"
>
<div
class=
"icon icon-shape bg-warning text-white rounded-circle shadow"
>
<i
class=
"fas fa-key"
></i>
</div>
</div>
</div>
</div>
</div>
...
...
@@ -49,6 +59,19 @@
<h5
class=
"card-title text-uppercase text-muted mb-0"
>
Secure
</h5>
<span
class=
"h2 font-weight-bold mb-0"
>
{% if app[4] %} Yes {% else %} No {% endif %}
</span>
</div>
{% if app[4] %}
<div
class=
"col-auto"
>
<div
class=
"icon icon-shape bg-info text-white rounded-circle shadow"
>
<i
class=
"fas fa-lock"
></i>
</div>
</div>
{% else %}
<div
class=
"col-auto"
>
<div
class=
"icon icon-shape bg-danger text-white rounded-circle shadow"
>
<i
class=
"fas fa-unlock"
></i>
</div>
</div>
{% endif %}
</div>
</div>
</div>
...
...
app/app/templates/new/admin/user-dashboard.html
View file @
7515fd5d
...
...
@@ -2,6 +2,10 @@
{% block title %} Administration - {{ user }} - Dashboard - HPC
&
A IoT {% endblock %}
{% block header %}
<link
href=
"https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css"
rel=
"stylesheet"
>
{% 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>
...
...
@@ -23,8 +27,8 @@
<span
class=
"h2 font-weight-bold mb-0"
>
{{ info[0] }}
</span>
</div>
<div
class=
"col-auto"
>
<div
class=
"icon icon-shape bg-
danger
text-white rounded-circle shadow"
>
<i
class=
"fas fa-c
hart-bar
"
></i>
<div
class=
"icon icon-shape bg-
success
text-white rounded-circle shadow"
>
<i
class=
"fas fa-c
ubes
"
></i>
</div>
</div>
</div>
...
...
@@ -40,8 +44,8 @@
<span
class=
"h2 font-weight-bold mb-0"
>
{{ info[1] }}
</span>
</div>
<div
class=
"col-auto"
>
<div
class=
"icon icon-shape bg-
warning
text-white rounded-circle shadow"
>
<i
class=
"fas fa-
chart-pie
"
></i>
<div
class=
"icon icon-shape bg-
info
text-white rounded-circle shadow"
>
<i
class=
"fas fa-
microchip
"
></i>
</div>
</div>
</div>
...
...
@@ -57,8 +61,8 @@
<span
class=
"h2 font-weight-bold mb-0"
>
{{ info[2] }}
</span>
</div>
<div
class=
"col-auto"
>
<div
class=
"icon icon-shape bg-
yellow
text-white rounded-circle shadow"
>
<i
class=
"fas fa-
users
"
></i>
<div
class=
"icon icon-shape bg-
warning
text-white rounded-circle shadow"
>
<i
class=
"fas fa-
area-chart
"
></i>
</div>
</div>
</div>
...
...
@@ -74,8 +78,8 @@
<span
class=
"h2 font-weight-bold mb-0"
>
{{ info[3] }}
</span>
</div>
<div
class=
"col-auto"
>
<div
class=
"icon icon-shape bg-
info
text-white rounded-circle shadow"
>
<i
class=
"fas fa-
percen
t"
></i>
<div
class=
"icon icon-shape bg-
danger
text-white rounded-circle shadow"
>
<i
class=
"fas fa-
line-char
t"
></i>
</div>
</div>
</div>
...
...
app/app/views_admin.py
View file @
7515fd5d
...
...
@@ -101,7 +101,7 @@ def administration_user_new_application(name):
flash
(
'Error: {}'
.
format
(
res
[
1
]),
'danger'
)
return
render_template
(
request
.
url
)
res
=
dd
.
create_table
(
appkey
)
res
=
dd
.
create_table
_ddm
(
appkey
)
if
not
res
[
0
]:
ad
.
delete
(
appkey
)
...
...
@@ -129,7 +129,7 @@ def administration_user_application_add_device(name, appkey):
dev_list
=
dd
.
get_list
(
appkey
)
return
render_template
(
'new/admin/user-add-device.html'
,
app
=
ap
[
1
],
free_ids
=
misc
.
prep_id_range
(
dev_list
[
1
]),
models
=
ddm
.
MODELS
,
user
=
name
)
elif
request
.
method
==
'POST'
:
ddmin
=
misc
.
extract
_ddm
(
request
)
ddmin
=
ddm
.
extract
(
request
)
res
=
dd
.
create_ddm
(
request
.
form
[
'devname'
],
request
.
form
[
'devid'
],
appkey
,
request
.
form
[
'devdesc'
],
ddmin
)
if
not
res
[
0
]:
...
...
@@ -172,7 +172,7 @@ def administration_user_application_device_settings(name, appkey, devid):
return
render_template
(
'new/admin/user-application-device-settings.html'
,
app
=
ap
[
1
],
dev
=
dev
[
1
],
models
=
ddm
.
MODELS
,
user
=
name
)
elif
request
.
method
==
'POST'
:
ddmin
=
misc
.
extract
_ddm
(
request
)
ddmin
=
ddm
.
extract
(
request
)
res
=
dd
.
update_ddm
(
appkey
,
devid
,
request
.
form
[
'devname'
],
request
.
form
[
'devdesc'
],
ddmin
)
if
not
res
[
0
]:
...
...
@@ -438,7 +438,7 @@ def administration_user_application_device_download_csv(name, appkey, devid):
with
open
(
app
.
config
[
'DATA_DOWNLOAD_DIR_OS'
]
+
'/'
+
fn
,
'w+'
)
as
f
:
f
.
write
(
'utc,timestamp,'
)
for
d
in
d
umpd
[
1
][
0
][
2
]:
for
d
in
d
ev
[
3
][
'format'
]:
f
.
write
(
d
)
f
.
write
(
','
)
f
.
write
(
'
\n
'
)
...
...
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