Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
J
jumpserver
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
ops
jumpserver
Commits
bfd8a9c6
Commit
bfd8a9c6
authored
Nov 18, 2019
by
ibuler
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[Update] 修改asset permission搜索
parent
030551d9
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
23 additions
and
53 deletions
+23
-53
asset_permission_list.html
apps/perms/templates/perms/asset_permission_list.html
+14
-31
_filter_dropdown.html
apps/templates/_filter_dropdown.html
+2
-2
signals_handler.py
apps/tickets/signals_handler.py
+4
-4
ticket_list.html
apps/tickets/templates/tickets/ticket_list.html
+3
-16
No files found.
apps/perms/templates/perms/asset_permission_list.html
View file @
bfd8a9c6
...
...
@@ -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
()
})
...
...
apps/templates/_filter_dropdown.html
View file @
bfd8a9c6
...
...
@@ -50,8 +50,8 @@ function initTableFilterDropdown(selector, menu) {
var
offset
=
$
(
".search-help"
).
parent
().
offset
();
x
-=
offset
.
left
;
y
-=
offset
.
top
;
x
+=
18
;
y
+=
8
0
;
{
#
x
+=
18
;
#
}
y
+=
3
0
;
$
(
'.search-help'
).
css
({
"top"
:
y
+
"px"
,
"left"
:
x
+
"px"
,
"position"
:
"absolute"
});
$
(
'.dropdown-menu.search-help'
).
show
();
});
...
...
apps/tickets/signals_handler.py
View file @
bfd8a9c6
...
...
@@ -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
))
...
...
apps/tickets/templates/tickets/ticket_list.html
View file @
bfd8a9c6
...
...
@@ -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 %}
...
...
Write
Preview
Markdown
is supported
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