diff --git a/apps/perms/templates/perms/asset_permission_list.html b/apps/perms/templates/perms/asset_permission_list.html index 57079b4f8..f3d46a4f0 100644 --- a/apps/perms/templates/perms/asset_permission_list.html +++ b/apps/perms/templates/perms/asset_permission_list.html @@ -64,16 +64,7 @@ - +{% include '_filter_dropdown.html' %} {% endblock %} {% block custom_foot_js %} @@ -213,6 +204,17 @@ function initTree() { $(document).ready(function(){ initTable(); initTree(); + var filterMenu = [ + {title: "{% trans 'Name' %}", value: "name"}, + {title: "{% trans 'Validity' %}", value: "is_valid"}, + {title: "{% trans 'Username' %}", value: "username"}, + {title: "{% trans 'User group' %}", value: "user_group"}, + {title: "{% trans 'IP' %}", value: "ip"}, + {title: "{% trans 'Hostname' %}", value: "hostname"}, + {title: "{% trans 'Node' %}", value: "node"}, + {title: "{% trans 'System user' %}", value: "system_user"}, + ]; + initTableFilterDropdown('#permission_list_table_filter input', filterMenu) }) .on('click', '.btn-del', function () { var $this = $(this); @@ -270,27 +272,8 @@ $(document).ready(function(){ detailRows.push(tr.attr('id')); } } -}).on('click', '#permission_list_table_filter input', function (e) { - e.preventDefault(); - e.stopPropagation(); - var position = $('#permission_list_table_filter input').offset(); - var y = position['top']; - var x = position['left']; - x -= 220; - y += 30; - - $('.search-help').css({"top":y+"px", "left":x+"px", "position": "absolute"}); - $('.dropdown-menu.search-help').show(); -}).on('click', '.search-item', function (e) { - e.preventDefault(); - e.stopPropagation(); - var value = $(this).data('value'); - var old_value = $('#permission_list_table_filter input').val(); - var new_value = old_value + ' ' + value + ':'; - $('#permission_list_table_filter input').val(new_value.trim()); - $('.dropdown-menu.search-help').hide(); - $('#permission_list_table_filter input').focus() -}).on('click', 'body', function (e) { +}) +.on('click', 'body', function (e) { $('.dropdown-menu.search-help').hide() }) diff --git a/apps/templates/_filter_dropdown.html b/apps/templates/_filter_dropdown.html index 9237df0d5..3fff427bc 100644 --- a/apps/templates/_filter_dropdown.html +++ b/apps/templates/_filter_dropdown.html @@ -50,8 +50,8 @@ function initTableFilterDropdown(selector, menu) { var offset = $(".search-help").parent().offset(); x -= offset.left; y -= offset.top; - x += 18; - y += 80; + {#x += 18;#} + y += 30; $('.search-help').css({"top":y+"px", "left":x+"px", "position": "absolute"}); $('.dropdown-menu.search-help').show(); }); diff --git a/apps/tickets/signals_handler.py b/apps/tickets/signals_handler.py index 0e4298a61..811f6dabf 100644 --- a/apps/tickets/signals_handler.py +++ b/apps/tickets/signals_handler.py @@ -15,9 +15,9 @@ logger = get_logger(__name__) @receiver(m2m_changed, sender=Ticket.assignees.through) -def on_login_confirm_ticket_assignees_set(sender, instance=None, action=None, - reverse=False, model=None, - pk_set=None, **kwargs): +def on_ticket_assignees_set(sender, instance=None, action=None, + reverse=False, model=None, + pk_set=None, **kwargs): if action == 'post_add': logger.debug('New ticket create, send mail: {}'.format(instance.id)) assignees = model.objects.filter(pk__in=pk_set) @@ -30,7 +30,7 @@ def on_login_confirm_ticket_assignees_set(sender, instance=None, action=None, @receiver(post_save, sender=Ticket) -def on_login_confirm_ticket_status_change(sender, instance=None, created=False, **kwargs): +def on_ticket_status_change(sender, instance=None, created=False, **kwargs): if created or instance.status == "open": return logger.debug('Ticket changed, send mail: {}'.format(instance.id)) diff --git a/apps/tickets/templates/tickets/ticket_list.html b/apps/tickets/templates/tickets/ticket_list.html index c3d2c0f3b..fa7654180 100644 --- a/apps/tickets/templates/tickets/ticket_list.html +++ b/apps/tickets/templates/tickets/ticket_list.html @@ -12,7 +12,7 @@
- {% if not assign %} + {% if False %}
-{% include '_filter_dropdown.html' %} {% endblock %} {% block content_bottom_left %}{% endblock %} {% block custom_foot_js %} @@ -96,7 +96,6 @@ function initTable() { $(document).ready(function(){ initTable(); var menu = [ - {title: "IP", value: "ip"}, {title: "{% trans 'Title' %}", value: "title"}, {title: "{% trans 'User' %}", value: "user_display"}, {title: "{% trans 'Status' %}", value: "status", submenu: [ @@ -108,19 +107,7 @@ $(document).ready(function(){ {title: "{% trans 'Reject' %}", value: "reject"}, ]}, ]; - initTableFilterDropdown('#assigned-ticket-list-table input', menu) -}).on('click', '.btn-action', function () { - var ticketId = $(this).data("uid"); - var action = $(this).data('action'); - var ticketDetailUrl = "{% url 'api-tickets:ticket-detail' pk=DEFAULT_PK %}"; - ticketDetailUrl = ticketDetailUrl.replace("{{ DEFAULT_PK }}", ticketId); - var data = { - url: ticketDetailUrl, - body: JSON.stringify({action: action}), - method: "PATCH", - success: reloadPage - }; - requestApi(data); + initTableFilterDropdown('#ticket-list-table_filter input', menu) }) {% endblock %}