mirror of https://github.com/jumpserver/jumpserver
[Update] 修改asset permission搜索
parent
030551d987
commit
bfd8a9c66d
|
@ -64,16 +64,7 @@
|
|||
</div>
|
||||
</div>
|
||||
|
||||
<ul class="dropdown-menu search-help">
|
||||
<li><a class="search-item" data-value="name">{% trans 'Name' %}</a></li>
|
||||
<li><a class="search-item" data-value="is_valid">{% trans 'Validity' %}</a></li>
|
||||
<li><a class="search-item" data-value="username">{% trans 'Username' %}</a></li>
|
||||
<li><a class="search-item" data-value="user_group">{% trans 'User group' %}</a></li>
|
||||
<li><a class="search-item" data-value="ip">IP</a></li>
|
||||
<li><a class="search-item" data-value="hostname">{% trans 'Hostname' %}</a></li>
|
||||
<li><a class="search-item" data-value="node">{% trans 'Node' %}</a></li>
|
||||
<li><a class="search-item" data-value="system_user">{% trans 'System user' %}</a></li>
|
||||
</ul>
|
||||
{% 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()
|
||||
})
|
||||
|
||||
|
|
|
@ -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();
|
||||
});
|
||||
|
|
|
@ -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))
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
<div class="tab-content">
|
||||
<div id="my-tickets" class="tab-pane active">
|
||||
<div class="panel-body">
|
||||
{% if not assign %}
|
||||
{% if False %}
|
||||
<div class="uc pull-left m-r-5">
|
||||
<div class="btn-group">
|
||||
<button data-toggle="dropdown" class="btn btn-primary btn-sm dropdown-toggle" aria-expanded="false">
|
||||
|
@ -37,6 +37,7 @@
|
|||
<th class="text-center">{% trans 'Datetime' %}</th>
|
||||
</tr>
|
||||
</thead>
|
||||
{% include '_filter_dropdown.html' %}
|
||||
<tbody>
|
||||
</tbody>
|
||||
</table>
|
||||
|
@ -46,7 +47,6 @@
|
|||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{% 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)
|
||||
})
|
||||
</script>
|
||||
{% endblock %}
|
||||
|
|
Loading…
Reference in New Issue