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
8f163eb6
Commit
8f163eb6
authored
Mar 07, 2015
by
guanghongwei
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
统一分页
parent
de358099
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
22 additions
and
186 deletions
+22
-186
views.py
jperm/views.py
+4
-27
perm_list.html
templates/jperm/perm_list.html
+1
-31
sudo_list.html
templates/jperm/sudo_list.html
+2
-97
dept_list.html
templates/juser/dept_list.html
+1
-31
group_list.html
templates/juser/group_list.html
+7
-0
user_list.html
templates/juser/user_list.html
+7
-0
No files found.
jperm/views.py
View file @
8f163eb6
...
...
@@ -8,7 +8,7 @@ from jasset.models import Asset, BisGroup
from
jperm.models
import
Perm
,
SudoPerm
,
CmdGroup
from
django.core.paginator
import
Paginator
,
EmptyPage
,
InvalidPage
from
django.db.models
import
Q
from
jumpserver.views
import
LDAP_ENABLE
,
ldap_conn
,
CONF
,
page_list_return
from
jumpserver.views
import
LDAP_ENABLE
,
ldap_conn
,
CONF
,
page_list_return
,
pages
from
jumpserver.api
import
user_perm_asset_api
...
...
@@ -67,18 +67,7 @@ def perm_list(request):
contact_list
=
Perm
.
objects
.
filter
(
name__icontains
=
keyword
)
else
:
contact_list
=
Perm
.
objects
.
all
()
p
=
paginator
=
Paginator
(
contact_list
,
10
)
try
:
current_page
=
int
(
request
.
GET
.
get
(
'page'
,
'1'
))
except
ValueError
:
current_page
=
1
page_range
=
page_list_return
(
len
(
p
.
page_range
),
current_page
)
try
:
contacts
=
paginator
.
page
(
current_page
)
except
(
EmptyPage
,
InvalidPage
):
contacts
=
paginator
.
page
(
paginator
.
num_pages
)
contact_list
,
p
,
contacts
,
page_range
,
current_page
,
show_first
,
show_end
=
pages
(
contact_list
,
request
)
return
render_to_response
(
'jperm/perm_list.html'
,
locals
(),
context_instance
=
RequestContext
(
request
))
...
...
@@ -299,21 +288,9 @@ def sudo_add(request):
def
sudo_list
(
request
):
header_title
,
path1
,
path2
=
u'Sudo授权'
,
u'权限管理'
,
u'Sudo权限详情'
sudo_perms
=
contact_list
=
SudoPerm
.
objects
.
all
()
p1
=
paginator1
=
Paginator
(
contact_list
,
10
)
user_groups
=
UserGroup
.
objects
.
filter
(
id__gt
=
2
)
asset_groups
=
BisGroup
.
objects
.
all
()
cmd_groups
=
CmdGroup
.
objects
.
all
()
try
:
page1
=
int
(
request
.
GET
.
get
(
'page'
,
'1'
))
except
ValueError
:
page1
=
1
contact_list
=
SudoPerm
.
objects
.
all
()
try
:
contacts1
=
paginator1
.
page
(
page1
)
except
(
EmptyPage
,
InvalidPage
):
contacts1
=
paginator1
.
page
(
paginator1
.
num_pages
)
contact_list
,
p
,
contacts
,
page_range
,
current_page
,
show_first
,
show_end
=
pages
(
contact_list
,
request
)
return
render_to_response
(
'jperm/sudo_list.html'
,
locals
(),
context_instance
=
RequestContext
(
request
))
...
...
templates/jperm/perm_list.html
View file @
8f163eb6
...
...
@@ -90,37 +90,7 @@
Showing {{ contacts.start_index }} to {{ contacts.end_index }} of {{ p.count }} entries
</div>
</div>
<div
class=
"col-sm-6"
>
<div
class=
"dataTables_paginate paging_simple_numbers"
id=
"editable_paginate"
>
<ul
class=
"pagination"
style=
"margin-top: 0; float: right"
>
{% if contacts.has_previous %}
<li
class=
"paginate_button previous"
aria-controls=
"editable"
tabindex=
"0"
id=
"editable_previous"
>
<a
href=
"?page={{ contacts.previous_page_number }}"
>
Previous
</a>
</li>
{% else %}
<li
class=
"paginate_button previous disabled"
aria-controls=
"editable"
tabindex=
"0"
id=
"editable_previous"
>
<a
href=
"#"
>
Previous
</a>
</li>
{% endif %}
{% for page in page_range %}
{% ifequal current_page page %}
<li
class=
"paginate_button active"
aria-controls=
"editable"
tabindex=
"0"
><a
href=
"?page={{ page }}"
title=
"第{{ page }}页"
>
{{ page }}
</a></li>
{% else %}
<li
class=
"paginate_button"
aria-controls=
"editable"
tabindex=
"0"
><a
href=
"?page={{ page }}"
title=
"第{{ page }}页"
>
{{ page }}
</a></li>
{% endifequal %}
{% endfor %}
{% if contacts.has_next %}
<li
class=
"paginate_button next"
aria-controls=
"editable"
tabindex=
"0"
id=
"editable_next"
>
<a
href=
"?page={{ contacts.next_page_number }}"
>
Next
</a>
</li>
{% else %}
<li
class=
"paginate_button next disabled"
aria-controls=
"editable"
tabindex=
"0"
id=
"editable_next"
>
<a
href=
"#"
>
Next
</a>
</li>
{% endif %}
</ul>
</div>
</div>
{% include 'paginator.html' %}
</div>
</div>
...
...
templates/jperm/sudo_list.html
View file @
8f163eb6
...
...
@@ -73,7 +73,7 @@
</tr>
</thead>
<tbody
id=
"perm_list"
>
{% for sudo_perm in contacts1
.object_list %}
{% for sudo_perm in contacts
.object_list %}
<tr
class=
"gradeX"
>
<td
class=
"text-center"
>
{{ sudo_perm.name }}
</td>
<td
class=
"text-center"
>
{{ sudo_perm.user_runas }}
</td>
...
...
@@ -103,107 +103,12 @@
Showing {{ contacts1.start_index }} to {{ contacts1.end_index }} of {{ p1.count }} entries
</div>
</div>
<div
class=
"col-sm-6"
>
<div
class=
"dataTables_paginate paging_simple_numbers"
id=
"editable_paginate"
>
<ul
class=
"pagination"
style=
"margin-top: 0; float: right"
>
{% if contacts1.has_previous %}
<li
class=
"paginate_button previous"
aria-controls=
"editable"
tabindex=
"0"
id=
"editable_previous"
>
<a
href=
"?page={{ contacts1.previous_page_number }}"
>
Previous
</a>
</li>
{% else %}
<li
class=
"paginate_button previous disabled"
aria-controls=
"editable"
tabindex=
"0"
id=
"editable_previous"
>
<a
href=
"#"
>
Previous
</a>
</li>
{% endif %}
{% for page in p1.page_range %}
{% ifequal offset1 page %}
<li
class=
"paginate_button active"
aria-controls=
"editable"
tabindex=
"0"
><a
href=
"?page={{ page }}"
title=
"第{{ page }}页"
>
{{ page }}
</a></li>
{% else %}
<li
class=
"paginate_button"
aria-controls=
"editable"
tabindex=
"0"
><a
href=
"?page={{ page }}"
title=
"第{{ page }}页"
>
{{ page }}
</a></li>
{% endifequal %}
{% endfor %}
{% if contacts1.has_next %}
<li
class=
"paginate_button next"
aria-controls=
"editable"
tabindex=
"0"
id=
"editable_next"
>
<a
href=
"?page={{ contacts1.next_page_number }}"
>
Next
</a>
</li>
{% else %}
<li
class=
"paginate_button next disabled"
aria-controls=
"editable"
tabindex=
"0"
id=
"editable_next"
>
<a
href=
"#"
>
Next
</a>
</li>
{% endif %}
</ul>
</div>
</div>
</div>
</div>
<div
id=
"tab-2"
class=
"tab-pane"
>
<table
class=
"table table-striped table-bordered table-hover "
id=
"editable"
>
<thead>
<tr>
<th
class=
"text-center"
>
用户
</th>
<th
class=
"text-center"
>
角色
</th>
<th
class=
"text-center"
>
属组
</th>
<th
class=
"text-center"
>
主机数量
</th>
<th
class=
"text-center"
>
操作
</th>
</tr>
</thead>
<tbody
id=
"perm_list"
>
{% for user in contacts2.object_list %}
<tr
class=
"gradeX"
>
<td
class=
"text-center"
>
{{ user.name }}
</td>
<td
class=
"text-center"
>
{{ user.id | get_role }}
</td>
<td
class=
"text-center"
>
{{ user.username }}
</td>
<td
class=
"text-center"
>
{{ user.id }}
</td>
<td
class=
"text-center"
>
<a
title=
"[ {{ user.name }} ] 授权详情"
href=
"../perm_asset_detail/?id={{ user.id }}"
class=
"iframe btn btn-xs btn-primary"
>
详情
</a>
</td>
</tr>
{% endfor %}
</tbody>
</table>
<div
class=
"row"
>
<div
class=
"col-sm-6"
>
<div
class=
"dataTables_info"
id=
"editable_info"
role=
"status"
aria-live=
"polite"
>
Showing {{ contacts2.start_index }} to {{ contacts2.end_index }} of {{ p2.count }} entries
</div>
</div>
<div
class=
"col-sm-6"
>
<div
class=
"dataTables_paginate paging_simple_numbers"
id=
"editable_paginate"
>
<ul
class=
"pagination"
style=
"margin-top: 0; float: right"
>
{% if contacts2.has_previous %}
<li
class=
"paginate_button previous"
aria-controls=
"editable"
tabindex=
"0"
id=
"editable_previous"
>
<a
href=
"?page={{ contacts2.previous_page_number }}"
>
Previous
</a>
</li>
{% else %}
<li
class=
"paginate_button previous disabled"
aria-controls=
"editable"
tabindex=
"0"
id=
"editable_previous"
>
<a
href=
"#"
>
Previous
</a>
</li>
{% endif %}
{% for page in p2.page_range %}
{% ifequal offset1 page %}
<li
class=
"paginate_button active"
aria-controls=
"editable"
tabindex=
"0"
><a
href=
"?page={{ page }}"
title=
"第{{ page }}页"
>
{{ page }}
</a></li>
{% else %}
<li
class=
"paginate_button"
aria-controls=
"editable"
tabindex=
"0"
><a
href=
"?page={{ page }}"
title=
"第{{ page }}页"
>
{{ page }}
</a></li>
{% endifequal %}
{% endfor %}
{% if contacts2.has_next %}
<li
class=
"paginate_button next"
aria-controls=
"editable"
tabindex=
"0"
id=
"editable_next"
>
<a
href=
"?page={{ contacts2.next_page_number }}"
>
Next
</a>
</li>
{% else %}
<li
class=
"paginate_button next disabled"
aria-controls=
"editable"
tabindex=
"0"
id=
"editable_next"
>
<a
href=
"#"
>
Next
</a>
</li>
{% endif %}
</ul>
{% include 'paginator.html' %}
</div>
</div>
</div>
</div>
</div>
</div>
...
...
templates/juser/dept_list.html
View file @
8f163eb6
...
...
@@ -80,37 +80,7 @@
Showing {{ contacts.start_index }} to {{ contacts.end_index }} of {{ p.count }} entries
</div>
</div>
<div
class=
"col-sm-6"
>
<div
class=
"dataTables_paginate paging_simple_numbers"
id=
"editable_paginate"
>
<ul
class=
"pagination"
style=
"margin-top: 0; float: right"
>
{% if contacts.has_previous %}
<li
class=
"paginate_button previous"
aria-controls=
"editable"
tabindex=
"0"
id=
"editable_previous"
>
<a
href=
"?page={{ contacts.previous_page_number }}"
>
Previous
</a>
</li>
{% else %}
<li
class=
"paginate_button previous disabled"
aria-controls=
"editable"
tabindex=
"0"
id=
"editable_previous"
>
<a
href=
"#"
>
Previous
</a>
</li>
{% endif %}
{% for page in page_range %}
{% ifequal current_page page %}
<li
class=
"paginate_button active"
aria-controls=
"editable"
tabindex=
"0"
><a
href=
"?page={{ page }}"
title=
"第{{ page }}页"
>
{{ page }}
</a></li>
{% else %}
<li
class=
"paginate_button"
aria-controls=
"editable"
tabindex=
"0"
><a
href=
"?page={{ page }}"
title=
"第{{ page }}页"
>
{{ page }}
</a></li>
{% endifequal %}
{% endfor %}
{% if contacts.has_next %}
<li
class=
"paginate_button next"
aria-controls=
"editable"
tabindex=
"0"
id=
"editable_next"
>
<a
href=
"?page={{ contacts.next_page_number }}"
>
Next
</a>
</li>
{% else %}
<li
class=
"paginate_button next disabled"
aria-controls=
"editable"
tabindex=
"0"
id=
"editable_next"
>
<a
href=
"#"
>
Next
</a>
</li>
{% endif %}
</ul>
</div>
</div>
{% include 'paginator.html' %}
</div>
</div>
</div>
...
...
templates/juser/group_list.html
View file @
8f163eb6
...
...
@@ -76,11 +76,18 @@
{% endfor %}
</tbody>
</table>
<div
class=
"row"
>
<div
class=
"col-sm-6"
>
<div
class=
"dataTables_info"
id=
"editable_info"
role=
"status"
aria-live=
"polite"
>
Showing {{ contacts.start_index }} to {{ contacts.end_index }} of {{ p.count }} entries
</div>
</div>
{% include 'paginator.html' %}
</div>
</div>
</div>
</div>
</div>
</div>
<script>
...
...
templates/juser/user_list.html
View file @
8f163eb6
...
...
@@ -80,11 +80,18 @@
{% endfor %}
</tbody>
</table>
<div
class=
"row"
>
<div
class=
"col-sm-6"
>
<div
class=
"dataTables_info"
id=
"editable_info"
role=
"status"
aria-live=
"polite"
>
Showing {{ contacts.start_index }} to {{ contacts.end_index }} of {{ p.count }} entries
</div>
</div>
{% include 'paginator.html' %}
</div>
</div>
</div>
</div>
</div>
</div>
<script>
...
...
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