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
072da114
Commit
072da114
authored
Nov 06, 2016
by
ibuler
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Finish system user list
parent
968b1b4c
Hide whitespace changes
Inline
Side-by-side
Showing
14 changed files
with
104 additions
and
199 deletions
+104
-199
api.py
apps/assets/api.py
+18
-11
models.py
apps/assets/models.py
+9
-1
serializers.py
apps/assets/serializers.py
+10
-0
admin_user_list.html
apps/assets/templates/assets/admin_user_list.html
+17
-58
asset_list.html
apps/assets/templates/assets/asset_list.html
+2
-10
idc_assets.html
apps/assets/templates/assets/idc_assets.html
+1
-11
idc_list.html
apps/assets/templates/assets/idc_list.html
+1
-14
urls.py
apps/assets/urls.py
+10
-43
views.py
apps/assets/views.py
+17
-17
jumpserver.css
apps/static/css/jumpserver.css
+10
-0
style.css
apps/static/css/style.css
+3
-3
jumpserver.js
apps/static/js/jumpserver.js
+3
-2
user_group_list.html
apps/users/templates/users/user_group_list.html
+3
-16
user_list.html
apps/users/templates/users/user_list.html
+0
-13
No files found.
apps/assets/api.py
View file @
072da114
...
...
@@ -26,6 +26,13 @@ class AssetViewSet(viewsets.ModelViewSet):
queryset
=
Asset
.
objects
.
all
()
serializer_class
=
serializers
.
AssetSerializer
def
get_queryset
(
self
):
queryset
=
super
(
AssetViewSet
,
self
)
.
get_queryset
()
idc
=
self
.
request
.
query_params
.
get
(
'idc'
,
''
)
if
idc
:
queryset
=
queryset
.
filter
(
idc__id
=
idc
)
return
queryset
class
IDCViewSet
(
viewsets
.
ModelViewSet
):
"""API endpoint that allows IDC to be viewed or edited."""
...
...
@@ -46,17 +53,17 @@ class SystemUserViewSet(viewsets.ModelViewSet):
permission_classes
=
(
IsSuperUser
,)
class
IDCAssetsApi
(
generics
.
ListAPIView
):
model
=
IDC
serializer_class
=
serializers
.
AssetSerializer
def
get
(
self
,
request
,
*
args
,
**
kwargs
):
filter_kwargs
=
{
self
.
lookup_field
:
self
.
kwargs
[
self
.
lookup_field
]}
self
.
object
=
get_object_or_404
(
self
.
model
,
**
filter_kwargs
)
return
super
(
IDCAssetsApi
,
self
)
.
get
(
request
,
*
args
,
**
kwargs
)
def
get_queryset
(
self
):
return
self
.
object
.
assets
.
all
()
#
class IDCAssetsApi(generics.ListAPIView):
#
model = IDC
#
serializer_class = serializers.AssetSerializer
#
#
def get(self, request, *args, **kwargs):
#
filter_kwargs = {self.lookup_field: self.kwargs[self.lookup_field]}
#
self.object = get_object_or_404(self.model, **filter_kwargs)
#
return super(IDCAssetsApi, self).get(request, *args, **kwargs)
#
#
def get_queryset(self):
#
return self.object.assets.all()
class
AssetListUpdateApi
(
BulkDeleteApiMixin
,
ListBulkCreateUpdateDestroyAPIView
):
...
...
apps/assets/models.py
View file @
072da114
...
...
@@ -107,7 +107,7 @@ class AdminUser(models.Model):
@property
def
password
(
self
):
return
decrypt
(
self
.
_password
)
return
signer
.
unsign
(
self
.
_password
)
@password.setter
def
password
(
self
,
password_raw
):
...
...
@@ -129,6 +129,10 @@ class AdminUser(models.Model):
def
public_key
(
self
,
public_key_raw
):
self
.
_public_key
=
signer
.
sign
(
public_key_raw
)
@property
def
assets_amount
(
self
):
return
self
.
assets
.
count
()
class
Meta
:
db_table
=
'admin_user'
...
...
@@ -216,6 +220,10 @@ class SystemUser(models.Model):
assets
=
set
(
self
.
assets
.
all
())
|
self
.
get_assets_inherit_from_asset_groups
()
return
list
(
assets
)
@property
def
assets_amount
(
self
):
return
self
.
assets
.
count
()
class
Meta
:
db_table
=
'system_user'
...
...
apps/assets/serializers.py
View file @
072da114
...
...
@@ -38,11 +38,21 @@ class AdminUserSerializer(serializers.ModelSerializer):
class
Meta
:
model
=
AdminUser
def
get_field_names
(
self
,
declared_fields
,
info
):
fields
=
super
(
AdminUserSerializer
,
self
)
.
get_field_names
(
declared_fields
,
info
)
fields
.
append
(
'assets_amount'
)
return
fields
class
SystemUserSerializer
(
serializers
.
ModelSerializer
):
class
Meta
:
model
=
SystemUser
def
get_field_names
(
self
,
declared_fields
,
info
):
fields
=
super
(
SystemUserSerializer
,
self
)
.
get_field_names
(
declared_fields
,
info
)
fields
.
append
(
'assets_amount'
)
return
fields
class
IDCSerializer
(
serializers
.
ModelSerializer
):
assets_amount
=
serializers
.
SerializerMethodField
()
...
...
apps/assets/templates/assets/admin_user_list.html
View file @
072da114
{% extends '_base_list.html' %}
{#{% load i18n %}#}
{#{% load common_tags %}#}
{#{% block content_left_head %}#}
{#
<a
href=
"{% url 'assets:admin-user-create' %}"
class=
"btn btn-sm btn-primary "
>
{% trans "Create admin user" %}
</a>
#}
{#{% endblock %}#}
{##}
{#{% block table_head %}#}
{#
<th
class=
"text-center"
>
{% trans 'ID' %}
</th>
#}
{#
<th
class=
"text-center"
><a
href=
"{% url 'assets:admin-user-list' %}?sort=name"
>
{% trans 'Name' %}
</a></th>
#}
{#
<th
class=
"text-center"
><a
href=
"{% url 'assets:admin-user-list' %}?sort=username"
>
{% trans 'Username' %}
</a></th>
#}
{#
<th
class=
"text-center"
>
{% trans 'Asset num' %}
</th>
#}
{#
<th
class=
"text-center"
>
{% trans 'Lost connection' %}
</th>
#}
{#
<th
class=
"text-center"
>
{% trans 'Comment' %}
</th>
#}
{#
<th
class=
"text-center"
></th>
#}
{#{% endblock %}#}
{##}
{#{% block table_body %}#}
{# {% for admin_user in admin_user_list %}#}
{#
<tr
class=
"gradeX"
>
#}
{#
<td
class=
"text-center"
>
{{ admin_user.id }}
</td>
#}
{#
<td>
#}
{#
<a
href=
"{% url 'assets:admin-user-detail' pk=admin_user.id %}"
>
#}
{# {{ admin_user.name }}#}
{#
</a>
#}
{#
</td>
#}
{#
<td
class=
"text-center"
>
{{ admin_user.username }}
</td>
#}
{#
<td
class=
"text-center"
>
{{ admin_user.assets.count }}
</td>
#}
{#
<td
class=
"text-center"
>
{{ admin_user.assets.count }}
</td>
#}
{#
<td
class=
"text-center"
>
{{ admin_user.comment|truncatewords:8 }}
</td>
#}
{#
<td
class=
"text-center"
>
#}
{#
<!-- Todo: Click script button will paste a url to clipboard like: curl http://url/admin_user_create.sh | bash -->
#}
{#
<a
href=
"{% url 'assets:admin-user-update' pk=admin_user.id %}"
class=
"btn btn-xs btn-primary"
>
{% trans 'Script' %}
</a>
#}
{#
<!-- Todo: Click refresh button will run a task to test admin user could connect asset or not immediately -->
#}
{#
<a
href=
"{% url 'assets:admin-user-update' pk=admin_user.id %}"
class=
"btn btn-xs btn-warning"
>
{% trans 'Refresh' %}
</a>
#}
{#
<a
href=
"{% url 'assets:admin-user-update' pk=admin_user.id %}"
class=
"btn btn-xs btn-info"
>
{% trans 'Update' %}
</a>
#}
{#
<a
onclick=
"obj_del(this,'{{ admin_user.name }}','{% url 'assets:admin-user-delete' admin_user.id %}')"
class=
"btn btn-xs btn-danger del"
>
{% trans 'Delete' %}
</a>
#}
{#
</td>
#}
{#
</tr>
#}
{# {% endfor %}#}
{#{% endblock %}#}
{% extends '_base_list.html' %}
{% load i18n static %}
{% block custom_head_css_js %}
{{ block.super }}
<style>
div
.dataTables_wrapper
div
.dataTables_filter
,
.dataTables_length
{
float
:
right
!important
;
}
div
.dataTables_wrapper
div
.dataTables_filter
,
.dataTables_length
{
float
:
right
!important
;
}
div
.dataTables_wrapper
div
.dataTables_filter
{
margin-left
:
15px
;
}
div
.dataTables_wrapper
div
.dataTables_filter
{
margin-left
:
15px
;
}
</style>
{% endblock %}
{% block table_search %}{% endblock %}
...
...
@@ -85,13 +44,13 @@ $(document).ready(function(){
ele
:
$
(
'#admin_user_list_table'
),
columnDefs
:
[
{
targets
:
1
,
createdCell
:
function
(
td
,
cellData
,
rowData
)
{
var
detail_btn
=
'<a href="{% url "assets:admin-user-detail" pk=99991937 %}">'
+
cellData
+
'</a>'
;
var
detail_btn
=
'<a href="{% url "assets:a
pi-a
dmin-user-detail" pk=99991937 %}">'
+
cellData
+
'</a>'
;
$
(
td
).
html
(
detail_btn
.
replace
(
'99991937'
,
rowData
.
id
));
}},
{
#
{
targets
:
4
,
createdCell
:
function
(
td
,
cellData
)
{
#
}
{
#
var
innerHtml
=
cellData
.
length
>
8
?
cellData
.
substring
(
0
,
8
)
+
'...'
:
cellData
;
#
}
{
#
$
(
td
).
html
(
'<a href="javascript:void(0);" data-toggle="tooltip" title="'
+
cellData
+
'">'
+
innerHtml
+
'</a>'
);
#
}
{
#
}},
#
}
{
targets
:
5
,
createdCell
:
function
(
td
,
cellData
)
{
var
innerHtml
=
cellData
.
length
>
8
?
cellData
.
substring
(
0
,
24
)
+
'...'
:
cellData
;
$
(
td
).
html
(
'<a href="javascript:void(0);" data-toggle="tooltip" title="'
+
cellData
+
'">'
+
innerHtml
+
'</a>'
);
}},
{
#
{
targets
:
6
,
createdCell
:
function
(
td
,
cellData
)
{
#
}
{
#
if
(
!
cellData
)
{
#
}
{
#
$
(
td
).
html
(
'<i class="fa fa-times text-danger"></i>'
)
#
}
...
...
@@ -100,13 +59,13 @@ $(document).ready(function(){
{
#
}
#
}
{
#
}},
#
}
{
targets
:
6
,
createdCell
:
function
(
td
,
cellData
,
rowData
)
{
var
update_btn
=
'<a href="{% url "assets:
idc
-update" pk=99991937 %}" class="btn btn-xs btn-info">{% trans "Update" %}</a>'
.
replace
(
'99991937'
,
cellData
);
var
del_btn
=
'<a class="btn btn-xs btn-danger m-l-xs btn_user_delete" data-uid="99991937">{% trans "Delete" %}</a>'
.
replace
(
'99991937'
,
cellData
);
var
update_btn
=
'<a href="{% url "assets:
admin-user
-update" pk=99991937 %}" class="btn btn-xs btn-info">{% trans "Update" %}</a>'
.
replace
(
'99991937'
,
cellData
);
var
del_btn
=
'<a class="btn btn-xs btn-danger m-l-xs btn_
admin_
user_delete" data-uid="99991937">{% trans "Delete" %}</a>'
.
replace
(
'99991937'
,
cellData
);
$
(
td
).
html
(
update_btn
+
del_btn
)
}}],
ajax_url
:
'{% url "assets:
idc-list-create-api
" %}'
,
columns
:
[{
data
:
function
(){
return
""
}},
{
data
:
"name"
},
{
data
:
"
assets_amount"
},
{
data
:
"contact"
},
{
data
:
"phone"
},
{
data
:
"
operator
"
},
{
data
:
"id"
}],
ajax_url
:
'{% url "assets:
api-admin-user-list
" %}'
,
columns
:
[{
data
:
function
(){
return
""
}},
{
data
:
"name"
},
{
data
:
"
username"
},
{
data
:
"assets_amount"
},
{
data
:
function
()
{
return
'lost'
}
},
{
data
:
"
comment
"
},
{
data
:
"id"
}],
op_html
:
$
(
'#actions'
).
html
()
};
jumpserver
.
initDataTable
(
options
);
...
...
apps/assets/templates/assets/asset_list.html
View file @
072da114
...
...
@@ -7,14 +7,6 @@
<script
src=
"{% static 'js/plugins/select2/select2.full.min.js' %}"
></script>
<style>
div
.dataTables_wrapper
div
.dataTables_filter
{
margin-left
:
15px
;
float
:
right
!important
;
}
div
.dataTables_wrapper
div
.dataTables_filter
,
.dataTables_length
{
float
:
right
!important
;
}
.custom
{
/*float:left;*/
margin-right
:
5px
;
...
...
@@ -80,7 +72,7 @@
</td>
<td
class=
"text-center"
>
<a
href=
"{% url 'assets:asset-update' pk=asset.id %}"
class=
"btn btn-xs btn-info"
>
{% trans 'Update' %}
</a>
<a
onclick=
"objectDelete(this,'{{ asset.hostname }}','{% url 'assets:a
sset-detail-update-delete-api
' pk=asset.id %}')"
class=
"btn btn-xs btn-danger del"
>
<a
onclick=
"objectDelete(this,'{{ asset.hostname }}','{% url 'assets:a
pi-asset-detail
' pk=asset.id %}')"
class=
"btn btn-xs btn-danger del"
>
{% trans 'Delete' %}
</a>
</td>
</tr>
...
...
@@ -198,7 +190,7 @@
var
column2
=
table
.
rows
(
'.selected'
).
data
();
var
id_list
=
[];
var
plain_id_list
=
[];
var
the_url
=
"{% url 'assets:a
sset-bulk-update-api
' %}"
;
var
the_url
=
"{% url 'assets:a
pi-asset-bulk-update
' %}"
;
for
(
var
i
=
0
;
i
<
column2
.
length
;
i
++
){
id_list
.
push
({
id
:
column2
[
i
].
id
,
hostname
:
column2
[
i
].
ip
});
plain_id_list
.
push
(
parseInt
(
column2
[
i
].
id
));
...
...
apps/assets/templates/assets/idc_assets.html
View file @
072da114
...
...
@@ -7,16 +7,6 @@
{% block custom_head_css_js %}
<link
href=
"{% static "
css
/
plugins
/
select2
/
select2
.
min
.
css
"
%}"
rel=
"stylesheet"
>
<script
src=
"{% static "
js
/
plugins
/
select2
/
select2
.
full
.
min
.
js
"
%}"
></script>
<style>
div
.dataTables_wrapper
div
.dataTables_filter
,
.dataTables_length
{
float
:
right
!important
;
}
div
.dataTables_wrapper
div
.dataTables_filter
{
margin-left
:
15px
;
}
</style>
{% endblock %}
{% block content %}
<div
class=
"wrapper wrapper-content animated fadeInRight"
>
...
...
@@ -128,7 +118,7 @@
$
(
td
).
html
(
'<i class="fa fa-check text-navy"></i>'
)
}
}}],
ajax_url
:
'{% url "assets:
idc-assets-api" pk=idc.id %
}'
,
ajax_url
:
'{% url "assets:
api-asset-list" %}?idc={{ idc.id }
}'
,
columns
:
[{
data
:
function
(){
return
""
}},
{
data
:
"hostname"
},
{
data
:
"ip"
},
{
data
:
"port"
},
{
data
:
"type"
},
{
data
:
"is_active"
}]
};
...
...
apps/assets/templates/assets/idc_list.html
View file @
072da114
{% extends '_base_list.html' %}
{% load i18n static %}
{% block custom_head_css_js %}
{{ block.super }}
<style>
div
.dataTables_wrapper
div
.dataTables_filter
,
.dataTables_length
{
float
:
right
!important
;
}
div
.dataTables_wrapper
div
.dataTables_filter
{
margin-left
:
15px
;
}
</style>
{% endblock %}
{% block table_search %}{% endblock %}
{% block table_container %}
<div
class=
"uc pull-left m-l-5 m-r-5"
>
...
...
@@ -63,7 +50,7 @@ $(document).ready(function(){
var
del_btn
=
'<a class="btn btn-xs btn-danger m-l-xs btn_user_delete" data-uid="99991937">{% trans "Delete" %}</a>'
.
replace
(
'99991937'
,
cellData
);
$
(
td
).
html
(
update_btn
+
del_btn
)
}}],
ajax_url
:
'{% url "assets:
idc-list-create-api
" %}'
,
ajax_url
:
'{% url "assets:
api-idc-list
" %}'
,
columns
:
[{
data
:
function
(){
return
""
}},
{
data
:
"name"
},
{
data
:
"assets_amount"
},
{
data
:
"contact"
},
{
data
:
"phone"
},
{
data
:
"operator"
},
{
data
:
"id"
}],
op_html
:
$
(
'#actions'
).
html
()
...
...
apps/assets/urls.py
View file @
072da114
...
...
@@ -58,50 +58,17 @@ urlpatterns = [
]
# router = routers.DefaultRouter()
# router.register(r'v1/asset-groups/', api.AssetGroupViewSet)
# router.register(r'v1/assets/', api.AssetViewSet)
# router.register(r'v1/idc/', api.IDCViewSet)
asset_list_view
=
api
.
AssetViewSet
.
as_view
({
'get'
:
'list'
,
'post'
:
'create'
})
asset_detail_view
=
api
.
AssetViewSet
.
as_view
({
'get'
:
'retrieve'
,
'put'
:
'update'
,
'patch'
:
'partial_update'
,
'delete'
:
'destroy'
,
})
idc_list_view
=
api
.
IDCViewSet
.
as_view
({
'get'
:
'list'
,
'post'
:
'create'
,
})
idc_detail_view
=
api
.
IDCViewSet
.
as_view
({
'get'
:
'retrieve'
,
'put'
:
'update'
,
'patch'
:
'partial_update'
,
'delete'
:
'destroy'
,
})
admin_user_list_view
=
api
.
AdminUserViewSet
.
as_view
({
'get'
:
'list'
,
'post'
:
'create'
,
})
router
=
routers
.
DefaultRouter
()
router
.
register
(
r'v1/asset-groups'
,
api
.
AssetGroupViewSet
,
'api-asset-group'
)
router
.
register
(
r'v1/assets'
,
api
.
AssetViewSet
,
'api-asset'
)
router
.
register
(
r'v1/idc'
,
api
.
IDCViewSet
,
'api-idc'
)
router
.
register
(
r'v1/admin-user'
,
api
.
AdminUserViewSet
,
'api-admin-user'
)
router
.
register
(
r'v1/system-user'
,
api
.
SystemUserViewSet
,
'api-system-user'
)
urlpatterns
+=
[
url
(
r'^v1/assets/$'
,
asset_list_view
,
name
=
'asset-list-create-api'
),
url
(
r'^v1/assets/(?P<pk>[0-9]+)/$'
,
asset_detail_view
,
name
=
'asset-detail-update-delete-api'
),
url
(
r'^v1/assets_bulk/$'
,
api
.
AssetListUpdateApi
.
as_view
(),
name
=
'asset-bulk-update-api'
),
url
(
r'^v1/idc/$'
,
idc_list_view
,
name
=
'idc-list-create-api'
),
url
(
r'^v1/idc/(?P<pk>[0-9]+)/$'
,
idc_detail_view
,
name
=
'idc-detail-update-delete-api'
),
url
(
r'^v1/idc/(?P<pk>[0-9]+)/assets/$'
,
api
.
IDCAssetsApi
.
as_view
(),
name
=
'idc-assets-api'
),
url
(
r'^v1/admin-user/$'
,
idc_list_view
,
name
=
'idc-list-create-api'
),
url
(
r'^v1/idc/(?P<pk>[0-9]+)/$'
,
idc_detail_view
,
name
=
'idc-detail-update-delete-api'
),
url
(
r'^v1/system-user/auth/'
,
api
.
SystemUserAuthApi
.
as_view
(),
name
=
'system-user-auth'
),
url
(
r'^v1/assets_bulk/$'
,
api
.
AssetListUpdateApi
.
as_view
(),
name
=
'api-asset-bulk-update'
),
# url(r'^v1/idc/(?P<pk>[0-9]+)/assets/$', api.IDCAssetsApi.as_view(), name='api-idc-assets'),
url
(
r'^v1/system-user/auth/'
,
api
.
SystemUserAuthApi
.
as_view
(),
name
=
'api-system-user-auth'
),
]
urlpatterns
+=
router
.
urls
apps/assets/views.py
View file @
072da114
...
...
@@ -431,34 +431,34 @@ class IDCDeleteView(AdminUserRequiredMixin, DeleteView):
success_url
=
reverse_lazy
(
'assets:idc-list'
)
class
AdminUserListView
(
AdminUserRequiredMixin
,
List
View
):
class
AdminUserListView
(
AdminUserRequiredMixin
,
Template
View
):
model
=
AdminUser
paginate_by
=
settings
.
CONFIG
.
DISPLAY_PER_PAGE
context_object_name
=
'admin_user_list'
#
paginate_by = settings.CONFIG.DISPLAY_PER_PAGE
#
context_object_name = 'admin_user_list'
template_name
=
'assets/admin_user_list.html'
def
get_context_data
(
self
,
**
kwargs
):
context
=
{
'app'
:
_
(
'Assets'
),
'action'
:
_
(
'Admin user list'
),
'keyword'
:
self
.
request
.
GET
.
get
(
'keyword'
,
''
)
#
'keyword': self.request.GET.get('keyword', '')
}
kwargs
.
update
(
context
)
return
super
(
AdminUserListView
,
self
)
.
get_context_data
(
**
kwargs
)
def
get_queryset
(
self
):
#
Todo: Default order by lose asset connection num
self
.
queryset
=
super
(
AdminUserListView
,
self
)
.
get_queryset
()
self
.
keyword
=
keyword
=
self
.
request
.
GET
.
get
(
'keyword'
,
''
)
self
.
sort
=
sort
=
self
.
request
.
GET
.
get
(
'sort'
,
'-date_created'
)
if
keyword
:
self
.
queryset
=
self
.
queryset
.
filter
(
Q
(
name__icontains
=
keyword
)
|
Q
(
comment__icontains
=
keyword
))
if
sort
:
self
.
queryset
=
self
.
queryset
.
order_by
(
sort
)
return
self
.
queryset
#
def get_queryset(self):
#
Todo: Default order by lose asset connection num
#
self.queryset = super(AdminUserListView, self).get_queryset()
#
self.keyword = keyword = self.request.GET.get('keyword', '')
#
self.sort = sort = self.request.GET.get('sort', '-date_created')
#
#
if keyword:
#
self.queryset = self.queryset.filter(Q(name__icontains=keyword) |
#
Q(comment__icontains=keyword))
#
#
if sort:
#
self.queryset = self.queryset.order_by(sort)
#
return self.queryset
class
AdminUserCreateView
(
AdminUserRequiredMixin
,
SuccessMessageMixin
,
CreateView
):
...
...
apps/static/css/jumpserver.css
View file @
072da114
...
...
@@ -255,3 +255,12 @@ table.dataTable tbody td.selected td i.text-navy
font-size
:
12px
;
vertical-align
:
middle
;
}
div
.dataTables_wrapper
div
.dataTables_filter
,
.dataTables_length
{
float
:
right
!important
;
}
div
.dataTables_wrapper
div
.dataTables_filter
{
margin-left
:
15px
;
}
\ No newline at end of file
apps/static/css/style.css
View file @
072da114
...
...
@@ -1585,9 +1585,9 @@ table.dataTable thead .sorting_desc_disabled {
.dataTables_wrapper
{
padding-bottom
:
30px
;
}
.dataTables_length
{
float
:
left
;
}
/*.dataTables_length {*/
/*float: left;*/
/*}*/
.dataTables_filter
label
{
margin-right
:
5px
;
}
...
...
apps/static/js/jumpserver.js
View file @
072da114
...
...
@@ -293,7 +293,7 @@ jumpserver.initDataTable = function (options) {
];
columnDefs
=
options
.
columnDefs
?
options
.
columnDefs
.
concat
(
columnDefs
)
:
columnDefs
;
var
table
=
ele
.
DataTable
({
pageLength
:
options
.
pageLength
||
2
5
,
pageLength
:
options
.
pageLength
||
1
5
,
dom
:
options
.
dom
||
'<"#uc.pull-left"><"html5buttons"B>flti<"row m-t"<"#op.col-md-6"><"col-md-6"p>>'
,
language
:
{
url
:
options
.
i18n_url
||
"/static/js/plugins/dataTables/i18n/zh-hans.json"
...
...
@@ -330,7 +330,8 @@ jumpserver.initDataTable = function (options) {
url
:
options
.
ajax_url
,
dataSrc
:
""
},
columns
:
options
.
columns
||
[]
columns
:
options
.
columns
||
[],
lengthMenu
:
[[
15
,
25
,
50
,
-
1
],
[
15
,
25
,
50
,
"All"
]]
});
table
.
on
(
'select'
,
function
(
e
,
dt
,
type
,
indexes
)
{
var
$node
=
table
[
type
](
indexes
).
nodes
().
to$
();
...
...
apps/users/templates/users/user_group_list.html
View file @
072da114
{% extends '_base_list.html' %}
{% load i18n static %}
{% block custom_head_css_js %}
{{ block.super }}
<style>
div
.dataTables_wrapper
div
.dataTables_filter
,
.dataTables_length
{
float
:
right
!important
;
}
div
.dataTables_wrapper
div
.dataTables_filter
{
margin-left
:
15px
;
}
</style>
{% endblock %}
{% block table_search %}{% endblock %}
{% block table_container %}
<div
class=
"pull-left m-r-5"
><a
href=
"{% url 'users:user-group-create' %}"
class=
"btn btn-sm btn-primary "
>
{% trans "Add User Group" %}
</a></div>
...
...
@@ -20,10 +7,10 @@ div.dataTables_wrapper div.dataTables_filter {
<thead>
<tr>
<th
class=
"text-center"
>
<
div
class=
"checkbox checkbox-default"
><input
id=
""
type=
"checkbox"
class=
"ipt_check_all"
><label></label></div
>
<
input
id=
""
type=
"checkbox"
class=
"ipt_check_all"
>
</th>
<th
class=
"text-center"
>
{% trans 'Name' %}
</
a></
th>
<th
class=
"text-center"
>
{% trans 'User Amount' %}
</
a></
th>
<th
class=
"text-center"
>
{% trans 'Name' %}
</th>
<th
class=
"text-center"
>
{% trans 'User Amount' %}
</th>
<th
class=
"text-center"
>
{% trans 'Asset Amount' %}
</th>
<th
class=
"text-center"
>
{% trans 'Comment' %}
</th>
<th
class=
"text-center"
>
{% trans 'Action' %}
</th>
...
...
apps/users/templates/users/user_list.html
View file @
072da114
{% extends '_base_list.html' %}
{% load i18n static %}
{% block custom_head_css_js %}
{{ block.super }}
<style>
div
.dataTables_wrapper
div
.dataTables_filter
,
.dataTables_length
{
float
:
right
!important
;
}
div
.dataTables_wrapper
div
.dataTables_filter
{
margin-left
:
15px
;
}
</style>
{% endblock %}
{% block table_search %}{% endblock %}
{% block table_container %}
<div
class=
"uc pull-left"
><a
href=
"javascript:void(0);"
class=
"btn btn-sm btn-primary"
data-toggle=
"modal"
data-target=
"#user_import_modal"
>
{% trans "Import user" %}
</a></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