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
f72c5753
Commit
f72c5753
authored
Dec 01, 2015
by
ibuler
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
添加推送
parent
4b36fc54
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
29 additions
and
9 deletions
+29
-9
views.py
jperm/views.py
+3
-0
base.js
static/js/base.js
+3
-3
perm_role_detail.html
templates/jperm/perm_role_detail.html
+22
-5
perm_role_push.html
templates/jperm/perm_role_push.html
+1
-1
No files found.
jperm/views.py
View file @
f72c5753
...
...
@@ -396,9 +396,12 @@ def perm_role_push(request):
# 渲染数据
header_title
,
path1
,
path2
=
"系统角色"
,
"角色管理"
,
"角色推送"
role_id
=
request
.
GET
.
get
(
'id'
)
asset_ids
=
request
.
GET
.
get
(
'asset_id'
)
role
=
get_object
(
PermRole
,
id
=
role_id
)
assets
=
Asset
.
objects
.
all
()
asset_groups
=
AssetGroup
.
objects
.
all
()
if
asset_ids
:
need_push_asset
=
[
get_object
(
Asset
,
id
=
asset_id
)
for
asset_id
in
asset_ids
.
split
(
','
)]
if
request
.
method
==
"POST"
:
# 获取推荐角色的名称列表
...
...
static/js/base.js
View file @
f72c5753
...
...
@@ -16,9 +16,9 @@ function check_all(form) {
}
}
function
checkAll
(){
var
checklist
=
document
.
getElementsByName
(
"checked"
);
if
(
document
.
getElementById
(
"check_all"
).
checked
)
function
checkAll
(
id
,
name
){
var
checklist
=
document
.
getElementsByName
(
name
);
if
(
document
.
getElementById
(
id
).
checked
)
{
for
(
var
i
=
0
;
i
<
checklist
.
length
;
i
++
)
{
...
...
templates/jperm/perm_role_detail.html
View file @
f72c5753
...
...
@@ -175,7 +175,7 @@
<thead>
<tr>
<th
class=
"text-center"
>
<input
type=
"checkbox"
id=
"check_
all"
onclick=
"checkAll(
)"
>
<input
type=
"checkbox"
id=
"check_
push"
onclick=
"checkAll('check_push', 'asset_id'
)"
>
</th>
<th
class=
"text-center"
>
主机
</th>
<th
class=
"text-center"
>
密钥
</th>
...
...
@@ -188,7 +188,7 @@
{% for asset, info in pushed_asset.items %}
<tr
class=
"gradeX"
>
<th
class=
"text-center"
>
<input
type=
"checkbox"
name=
"
checke
d"
value=
"{{ asset.id }}"
>
<input
type=
"checkbox"
name=
"
asset_i
d"
value=
"{{ asset.id }}"
>
</th>
<td
class=
"text-center"
>
{{ asset.hostname }}
</td>
<td
class=
"text-center"
>
{{ info.key | yesno:"是,否,未知" }}
</td>
...
...
@@ -220,7 +220,6 @@
<a
class=
"dropdown-toggle"
data-toggle=
"dropdown"
href=
"#"
>
<i
class=
"fa fa-wrench"
></i>
</a>
<a
class=
"close-link"
>
<i
class=
"fa fa-times"
></i>
</a>
...
...
@@ -229,9 +228,13 @@
<div
class=
"ibox-content"
>
<div>
<div
class=
"text-left"
>
<table
class=
"table table-striped"
id=
"ugedit"
>
<table
class=
"table table-striped"
>
<a
class=
"btn btn-xs btn-primary push_muti"
>
推送
</a>
<thead>
<tr>
<th
class=
"text-center"
>
<input
type=
"checkbox"
id=
"check_no_push"
onclick=
"checkAll('check_no_push', 'asset_no_push_id')"
>
</th>
<th
class=
"text-center"
>
主机
</th>
<th
class=
"text-center"
>
IP
</th>
</tr>
...
...
@@ -239,6 +242,9 @@
<tbody>
{% for asset in need_push_asset %}
<tr
class=
"gradeX"
>
<th
class=
"text-center"
>
<input
type=
"checkbox"
name=
"asset_no_push_id"
value=
"{{ asset.id }}"
>
</th>
<td
class=
"text-center"
>
{{ asset.hostname }}
</td>
<td
class=
"text-center"
>
{{ asset.ip }}
</td>
</tr>
...
...
@@ -276,10 +282,11 @@
$
(
'.del_muti'
).
click
(
function
(){
var
check_array
=
[];
if
(
confirm
(
"确定删除"
))
{
$
(
".gradeX input:checked"
).
each
(
function
()
{
$
(
".gradeX input
[name='asset_id']
:checked"
).
each
(
function
()
{
check_array
.
push
(
$
(
this
).
attr
(
"value"
))
});
var
url
=
'/jperm/role/recycle/?role_id={{ role.id }}&asset_id='
+
check_array
.
join
(
','
);
console
.
log
(
check_array
);
$
.
get
(
url
,
{},
function
(
data
){
...
...
@@ -290,6 +297,15 @@
return
false
;
});
$
(
'.push_muti'
).
click
(
function
(){
var
check_array
=
[];
$
(
".gradeX input[name='asset_no_push_id']:checked"
).
each
(
function
()
{
check_array
.
push
(
$
(
this
).
attr
(
"value"
))
});
var
url
=
'/jperm/role/push/?id={{ role.id }}&asset_id='
+
check_array
.
join
(
','
);
$
(
this
).
attr
(
'href'
,
url
)
})
})
</script>
{% endblock %}
\ No newline at end of file
templates/jperm/perm_role_push.html
View file @
f72c5753
...
...
@@ -45,7 +45,7 @@
<div
class=
"col-sm-8"
>
<select
name=
"assets"
id=
"assets"
data-placeholder=
"请选择资产"
class=
"chosen-select form-control m-b"
multiple
tabindex=
"2"
>
{% for asset in assets %}
<option
value=
"{{ asset.id }}"
{%
if
asset
in
pushed_assets
%}
selected
{%
endif
%}
>
{{ asset.hostname }}
</option>
<option
value=
"{{ asset.id }}"
{%
if
asset
in
need_push_asset
%}
selected
{%
endif
%}
>
{{ asset.hostname }}
</option>
{% endfor %}
</select>
</div>
...
...
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