Commit 314f9ecd authored by Vladislav Rykov's avatar Vladislav Rykov
Browse files

admin:user application automation view added

parent 33e4d418
{% extends 'logged_layout.html' %}
{% block title %} Administration - {{ user }} - {{ app[0] }} - Automation - 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">Automation</h3>
</div>
<div class="card-body">
{% if automations %}
<table class="table">
<thead>
<th> Name </th>
<th> Statement </th>
<th> </th>
</thead>
<tbody>
{% for a in automations %}
<tr>
<th> {{ a[3] }} </th>
<th> {{ a[4] }} </th>
<th> <a href="javascript:void(0)" onclick="return remove_automation('{{ a[0] }}', '{{ a[2] }}');"> <span class="fa fa-remove"</span> </a> </th>
</tr>
{% endfor %}
</tbody>
</table>
{% else %}
<center><p> There are no automations for the given application.</p> </center>
{% endif %}
<br>
<div class="col-lg-4">
<a href="/administration/users/{{ user }}/application/{{ app[1] }}/new-automation"><button class="btn btn-primary" type="submit">New Automation</button></a>
</div>
</div>
</div>
</div>
</div>
{% endblock %}
{% block script %}
<script type="text/javascript">
function remove_automation(id, devid) {
$.ajax({
url:"/administration/users/{{ user }}/application/{{ app[1] }}/delete-automation?id="+id+"&devid="+devid,
type:"get",
success: function() {
location.reload();
}
});
}
</script>
{% endblock %}
...@@ -200,6 +200,16 @@ def administration_users_user_application_new_alert(name, appkey): ...@@ -200,6 +200,16 @@ def administration_users_user_application_new_alert(name, appkey):
flash('Error creating new alert: {}. Make sure you have filled all form fields.'.format(e), 'danger') flash('Error creating new alert: {}. Make sure you have filled all form fields.'.format(e), 'danger')
return redirect(request.url) return redirect(request.url)
@app.route('/administration/users/<name>/application/<appkey>/automation')
@restricted(access_level='admin')
def administration_users_user_application_automation(name, appkey):
ap = ad.get(appkey)
ats = nfs.get_automation_list(appkey)
return render_template('new/admin/user-application-automation.html', automations=ats[1], app=ap[1], user=name)
@app.route('/administration/users/<name>/application/<appkey>/delete-<ntype>') @app.route('/administration/users/<name>/application/<appkey>/delete-<ntype>')
@restricted(access_level='admin') @restricted(access_level='admin')
def administration_users_user_application_notification_remove(name, appkey, ntype): def administration_users_user_application_notification_remove(name, appkey, ntype):
......
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