From 1d29c52a435c6cbc0bac2bf6141326e7952ce028 Mon Sep 17 00:00:00 2001 From: ibuler Date: Fri, 4 Nov 2016 19:25:10 +0800 Subject: [PATCH] Update datatable --- .../templates/audits/proxy_log_list.html | 154 ++++++----------- apps/audits/views.py | 4 +- .../perms/asset_permission_list.html | 163 ++++++------------ 3 files changed, 106 insertions(+), 215 deletions(-) diff --git a/apps/audits/templates/audits/proxy_log_list.html b/apps/audits/templates/audits/proxy_log_list.html index e28cc3cd7..e79f5e514 100644 --- a/apps/audits/templates/audits/proxy_log_list.html +++ b/apps/audits/templates/audits/proxy_log_list.html @@ -1,108 +1,58 @@ {% extends '_base_list.html' %} -{% load i18n static %} -{% block custom_head_css_js %} - {{ block.super }} - - - +{% block table_head %} + {% trans 'ID' %} + {% trans 'Username' %} + {% trans 'IP' %} + {% trans 'System user' %} + {% trans 'Command' %} + {% trans 'Success' %} + {% trans 'Finished' %} + {% trans 'Date start' %} + {% trans 'Time' %} {% endblock %} -{% block table_search %}{% endblock %} -{% block table_container %} -{#
{% trans "Create user" %}
#} - - - - - - - - {# #} - - - - - - - - - - -
-
- -
-
{% trans 'Username' %}{% trans 'IP' %}{% trans 'System user' %}{% trans 'Login type' %}{% trans 'Command' %}{% trans 'Success' %}{% trans 'Finished' %}{% trans 'Date start' %}{% trans 'Time' %}{% trans 'Action' %}
+ +{% block table_body %} + {% for proxy_log in proxy_log_list %} + + + {{ proxy_log.id }} + + {{ proxy_log.username }} + {{ proxy_log.ip }} + {{ proxy_log.system_user.name }} + {{ proxy_log.command.count }} + + {% if proxy_log.was_failed %} + + {% else %} + + {% endif %} + + + {% if proxy_log.is_finished %} + + {% else %} + + {% endif %} + + {{ proxy_log.date_start }} + {{ proxy_log.date_finished }} + + {% endfor %} {% endblock %} + {% block custom_foot_js %} - - - + {% endblock %} + diff --git a/apps/audits/views.py b/apps/audits/views.py index 151c93967..bd1c9bf74 100644 --- a/apps/audits/views.py +++ b/apps/audits/views.py @@ -11,8 +11,10 @@ from .models import ProxyLog, CommandLog from .utils import AdminUserRequiredMixin -class ProxyLogListView(TemplateView): +class ProxyLogListView(ListView): + model = ProxyLog template_name = 'audits/proxy_log_list.html' + context_object_name = 'proxy_log_list' def get_context_data(self, **kwargs): context = super(ProxyLogListView, self).get_context_data(**kwargs) diff --git a/apps/perms/templates/perms/asset_permission_list.html b/apps/perms/templates/perms/asset_permission_list.html index 1c1b167c3..d7b06f1c2 100644 --- a/apps/perms/templates/perms/asset_permission_list.html +++ b/apps/perms/templates/perms/asset_permission_list.html @@ -1,120 +1,59 @@ {% extends '_base_list.html' %} {% load i18n %} -{% load static %} {% load common_tags %} -{% block custom_head_css_js %} - {{ block.super }} - +{% block content_left_head %} + {% trans "Create permission" %} {% endblock %} -{% block table_search %}{% endblock %} -{% block table_container %} -
- {% trans "Create permission" %} -
- - - - - - - - - - - - - - -
-
- -
-
{% trans 'Name' %}{% trans 'User' %}{% trans 'User group' %}{% trans 'Asset' %}{% trans 'Asset group' %}{% trans 'System user' %}{% trans 'Is valid' %}{% trans 'Action' %}
+ +{% block table_head %} + {% trans 'ID' %} + {% trans 'Name' %} + {% trans 'User' %} + {% trans 'User group' %} + {% trans 'Asset' %} + {% trans 'Asset group' %} + {% trans 'System user' %} + {% trans 'Is valid' %} + {% trans 'Action' %} +{% endblock %} + +{% block table_body %} + {% for asset_permission in asset_permission_list %} + + {{ asset_permission.id }} + + + {{ asset_permission.name }} + + + {{ asset_permission.users.count }} + {{ asset_permission.user_groups.count }} + {{ asset_permission.assets.count }} + {{ asset_permission.asset_groups.count }} + {{ asset_permission.system_users.count }} + + {% if asset_permission.is_valid %} + + {% else %} + + {% endif %} + + + {% trans 'Update' %} + {% trans 'Delete' %} + + + {% endfor %} {% endblock %} {% block custom_foot_js %} - + {% endblock %} - -