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
314f9ecd
Commit
314f9ecd
authored
Jun 02, 2020
by
Vladislav Rykov
Browse files
admin:user application automation view added
parent
33e4d418
Changes
3
Hide whitespace changes
Inline
Side-by-side
app/app/__pycache__/views_admin.cpython-37.pyc
View file @
314f9ecd
No preview for this file type
app/app/templates/new/admin/user-application-automation.html
0 → 100644
View file @
314f9ecd
{% 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"
>
-
</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"
>
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 %}
app/app/views_admin.py
View file @
314f9ecd
...
...
@@ -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'
)
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>'
)
@
restricted
(
access_level
=
'admin'
)
def
administration_users_user_application_notification_remove
(
name
,
appkey
,
ntype
):
...
...
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