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
b655c245
Commit
b655c245
authored
Jun 02, 2020
by
Vladislav Rykov
Browse files
admin:user application alerts view added
parent
d31e5a56
Changes
4
Hide whitespace changes
Inline
Side-by-side
app/app/__pycache__/views_admin.cpython-37.pyc
View file @
b655c245
No preview for this file type
app/app/templates/new/admin/user-application-alerts.html
0 → 100644
View file @
b655c245
{% extends 'logged_layout.html' %}
{% block title %} Administration - Users - Application - Alerts - HPC
&
A IoT {% endblock %}
{% block header %}
<link
href=
"https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css"
rel=
"stylesheet"
>
<script
type=
"text/javascript"
src=
"https://ajax.googleapis.com/ajax/libs/jquery/3.2.0/jquery.min.js"
></script>
{% 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/users"
>
Users
</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/users/{{ user }}"
>
{{ user }}
</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/users/{{ user }}/applications"
>
Applications
</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/users/{{ user }}/application/{{ app[1] }}"
>
{{ app[0] }}
</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"
>
Alerts
</h3>
</div>
<div
class=
"card-body"
>
{% if alert_list %}
<table
class=
"table"
>
<thead>
<th>
Name
</th>
<th>
Condition
</th>
<th>
Email
</th>
<th>
</th>
</thead>
<tbody>
{% for a in alert_list %}
<tr>
<th>
{{ a[3] }}
</th>
<th>
{{ a[4] }}
</th>
<th>
{{ a[6] }}
</th>
<th>
<a
href=
"javascript:void(0)"
onclick=
"return remove_alert('{{ a[0] }}', '{{ a[2] }}');"
>
<span
class=
"fa fa-remove"
</
span
>
</a>
</th>
</tr>
{% endfor %}
</tbody>
</table>
{% else %}
<center><p>
There are no alerts for the given application.
</p>
</center>
{% endif %}
<br>
<div
class=
"col-lg-4"
>
<a
href=
"/administration/{{ user }}/application/{{ app[1] }}/new-alert"
><button
class=
"btn btn-primary"
type=
"submit"
>
New Alert
</button></a>
</div>
</div>
</div>
</div>
</div>
{% endblock %}
{% block script %}
<script
type=
"text/javascript"
>
function
remove_alert
(
id
,
devid
)
{
$
.
ajax
({
url
:
"
/administration/{{ name }}/application/{{ app[1] }}/delete-alert?id=
"
+
id
+
"
&devid=
"
+
devid
,
type
:
"
get
"
,
success
:
function
()
{
location
.
reload
();
}
});
}
</script>
{% endblock %}
app/app/templates/new/admin/user-application.html
View file @
b655c245
{% extends 'logged_layout.html' %}
{% block title %}
HPC
&
A IoT
- {{ app[
1
] }} {% endblock %}
{% block title %}
Administration - Users
- {{ app[
0
] }}
- 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>
...
...
app/app/views_admin.py
View file @
b655c245
...
...
@@ -163,6 +163,14 @@ def administration_users_user_application_device(name, appkey, devid):
return
render_template
(
'new/admin/user-device.html'
,
dev
=
dev
[
1
],
app
=
ap
[
1
],
ltup
=
ltup
,
data
=
[],
total
=
cnt
[
1
][
0
],
user
=
name
)
@
app
.
route
(
'/administration/users/<name>/application/<appkey>/alerts'
)
@
restricted
(
access_level
=
'admin'
)
def
administration_users_user_application_alerts
(
name
,
appkey
):
ap
=
ad
.
get
(
appkey
)
alerts
=
nfs
.
get_alerts_list
(
appkey
)
return
render_template
(
'new/admin/user-application-alerts.html'
,
alert_list
=
alerts
[
1
],
app
=
ap
[
1
],
user
=
name
)
@
app
.
route
(
'/administration/users/<name>/application/<appkey>/device/<devid>/data/<var>/<dest>/<page>'
)
@
restricted
(
access_level
=
'admin'
)
def
administration_users_user_application_device_data
(
name
,
appkey
,
devid
,
var
,
dest
,
page
):
...
...
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