Commit b655c245 authored by Vladislav Rykov's avatar Vladislav Rykov
Browse files

admin:user application alerts view added

parent d31e5a56
{% 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"> &nbsp;-&nbsp; </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"> &nbsp;-&nbsp; </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"> &nbsp;-&nbsp; </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"> &nbsp;-&nbsp; </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 %}
{% extends 'logged_layout.html' %} {% extends 'logged_layout.html' %}
{% block title %} HPC&amp;A IoT - {{ app[1] }} {% endblock %} {% block title %} Administration - Users - {{ app[0] }} - HPC&amp;A IoT {% endblock %}
{% block location %} {% block location %}
<a class="h4 mb-0 text-white text-uppercase d-none d-lg-inline-block" href="/administration">Administration</a> <a class="h4 mb-0 text-white text-uppercase d-none d-lg-inline-block" href="/administration">Administration</a>
......
...@@ -163,6 +163,14 @@ def administration_users_user_application_device(name, appkey, devid): ...@@ -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) 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>') @app.route('/administration/users/<name>/application/<appkey>/device/<devid>/data/<var>/<dest>/<page>')
@restricted(access_level='admin') @restricted(access_level='admin')
def administration_users_user_application_device_data(name, appkey, devid, var, dest, page): def administration_users_user_application_device_data(name, appkey, devid, var, dest, page):
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment